Skip to content

A quick implementation of Service Locator in Swift / iOS

License

Notifications You must be signed in to change notification settings

MRoikjaer/SwiftServiceLocator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SwiftServiceLocator

A quick example of a service locator implementation in Swift.

Application dependencies are wired up in AppConfiguration. At this point the main application accesses the different modules (pods) of the app and asks them to register their dependencies in the provided service container.

Once configuration is done, the container can be passed around the App (Or stored globally). Classes that needs dependencies can then rely on only the Protocol types and resolve their corrosponding Implementing instances using the container.

Hopefully useful to someone, I've personally shied away from this favoring constructing dependencies using Coordinators or Factories in iOS :<)

About

A quick implementation of Service Locator in Swift / iOS

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages