Swift Dependency Injection using Swift Macros

Hello everyone!

I’m so excited to share with you my first Swift framework I wrote for swift dependency injection using the Swift Macros. It’s called SwiftDI and it’s inspired by the Spring Dependency Injection concept.

I spent less than 60 hours on winter break writing this framework and learning about Swift Macros. I think It is not a good version yet, it should be a beta version or blueprint version but it is testable and usable.

One thing that I can not solve is making the configuration simple by just using @EnableConfiguration and #ConfigContext without var classes and var protocols but sadly I can not do that because I can not control the priority execution of each macro. So I fail to do that auto-configuration. If you have any ideas or suggestions for me to try, please let me know.

I would appreciate it if you have any feedback. I will do my best to check your feedback and spend my remaining time from the job search to work on it. You can check out the repo I created with the framework: SwiftDI

It's an open-source project, so feel free to contribute with issues, pull requests or suggestions. I hope you find SwiftDI useful and fun to use!

2 Likes