Swift Dependency Injection

Open-source Swift projects categorized as Dependency Injection | Edit details

Top 16 Swift Dependency Injection Projects

  • GitHub repo Swinject

    Dependency injection framework for Swift with iOS/macOS/Linux

    Project mention: How do you guys see PHP and its framworks/CMS in 2025? | reddit.com/r/PHP | 2021-04-05
  • GitHub repo Cleanse

    Lightweight Swift Dependency Injection Framework

  • GitHub repo Resolver

    Swift Ultralight Dependency Injection / Service Locator framework

    Project mention: How to update a boolean in one view model from another view model? | reddit.com/r/SwiftUI | 2021-06-17

    Since multiple ViewModels need to access this data, I would avoid storing the data in a particular ViewModel—which should correlate only with a single, specific View—and instead implement this behavior in a third object (such as an AuthenticationService class). This way, both/any of your subsequent Views and ViewModels alike can all access that object as a single source of truth (by passing it around explicitly, putting it in the environment, or my favorite method: Resolver). Just remember to think about who should “own” data!

  • GitHub repo Needle

    Compile-time safe Swift dependency injection framework

  • GitHub repo Weaver

    Dependency Injection framework for Swift (iOS/macOS/Linux)

  • GitHub repo DITranquillity

    Dependency injection for iOS (Swift)

  • GitHub repo Pure

    Pure DI in Swift (by devxoul)

  • GitHub repo Deli

    Deli is an easy-to-use Dependency Injection(DI).

  • GitHub repo Locatable

    A micro-framework that leverages Swift Property Wrappers to implement the Service Locator pattern

  • GitHub repo DIKit

    Dependency Injection Framework for Swift, inspired by KOIN.

  • GitHub repo Corridor

    A Coreader-like Dependency Injection μFramework

  • GitHub repo Guise

    An elegant, flexible, type-safe dependency resolution framework for Swift (by Prosumma)

  • GitHub repo pilgrim

    Dependency injection for Swift (iOS, OSX, Linux). Strongly typed, pure Swift successor to Typhoon.

  • GitHub repo Impose

    Impose is a simple dependency injection library for Swift

    Project mention: How to handle dependency injection in SwiftUI | reddit.com/r/iOSProgramming | 2021-05-29
  • GitHub repo StoryboardBuilder

    Simple dependency injection for generating views from storyboard.

  • GitHub repo ViperServices

    Simple dependency injection container for services written for iOS in swift supporting boot order

NOTE: The open source projects on this list are ordered by number of github stars. The number of mentions indicates repo mentiontions in the last 12 Months or since we started tracking (Dec 2020). The latest post mention was on 2021-06-17.

Index

What are some of the best open-source Dependency Injection projects in Swift? This list will help you:

Project Stars
1 Swinject 4,737
2 Cleanse 1,615
3 Resolver 1,133
4 Needle 1,002
5 Weaver 578
6 DITranquillity 358
7 Pure 308
8 Deli 125
9 Locatable 109
10 DIKit 82
11 Corridor 57
12 Guise 49
13 pilgrim 38
14 Impose 7
15 StoryboardBuilder 5
16 ViperServices 4