# Swift Dependency Injection using Swift Macros

**URL:** <https://forums.swift.org/t/swift-dependency-injection-using-swift-macros/69308>\
**Category:** Community Showcase\
**Tags:** macros, dependency-injection, swift-macro\
**Created:** [January 6, 2024, 10:02pm UTC](https://forums.swift.org/t/swift-dependency-injection-using-swift-macros/69308 "2024-01-06T22:02:30Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![MeasnaLazi](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/measnalazi/32/33501_2.png) [@MeasnaLazi](https://forums.swift.org/u/MeasnaLazi)\
**Post date:** [January 6, 2024, 10:02pm UTC](https://forums.swift.org/t/swift-dependency-injection-using-swift-macros/69308/1 "2024-01-06T22:02:30Z")

</div>

**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](https://github.com/MeasnaLazi/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!
