Dependency injection for Swift (iOS, OSX, Linux). Strongly typed, pure Swift successor to Typhoon.
Pilgrim is a dependency injection library for Swift with the following features:
shared
, weakShared
, objectGraph
(a DI concept introduced by Typhoon, for desktop and pocket apps) & unshared
.You can use Pilgrim in apps that employ the object-oriented programming paradigm or that mix object-oriented and functional styles.
Want to start applying dependency injection to your code in two minutes? Follow the Quick Start guide!
class AppDelegate: UIResponder, UIApplicationDelegate {
@Assembled var assembly: ApplicationAssembly
@Assembled var cityRepo: CityRepository
@Assembled var rootViewController: RootViewController
var window: UIWindow?
func application(_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil) -> Bool {
window = assembly.window()
window?.makeKeyAndVisible()
if (cityRepo.loadSelectedCity() == nil) {
rootViewController.showCitiesListController()
}
return true
}
}
Here’s how your code might look, when you’re done with the quick start.
pod 'Pilgrim-DI'
Other installation methods (Swift Package Manager, etc) coming soon!
Here’s a sample app / starter template, to get up and running quickly.
The best way to get up and running is to try the quick start and sample app. After that the User Guide is your reference.
Not sure? There’s an introduction on the pilgrim.ph website. Head on over and take a look. We’ll meet back here.
If you can’t find what you need in the Quick Start or User Guides, please post a question on StackOverflow, using the pilgrim tag.
Great! A contribution guide, along with detailed documentation will be published in the coming days.
Please raise a GitHub issue.
Are you using Pilgrim and would like to support free & open-source software? Send us an email or PR to add your logo here.
Pilgrim is a non-profit, community driven project. We only ask that if you’ve found it useful to star us on Github or send a tweet mentioning us (@doctor_cerulean). If you’ve written a Pilgrim related blog or tutorial, or published a new Pilgrim-powered app, we’d certainly be happy to hear about that too.
Pilgrim is sponsored and led by AppsQuick.ly with contributions from around the world.
Copyright © 2020 Pilgrim Contributors