Skip to content

Instantly share code, notes, and snippets.

@FGoessler
FGoessler / ServiceLocator.swift
Created January 24, 2016 20:45
A very lightweight ServiceLocator implementation including a module mechanism written in Swift.
import Foundation
public protocol ServiceLocatorModul {
func registerServices(serviceLocator: ServiceLocator)
}
public class ServiceLocator {
private var registry = [ObjectIdentifier:Any]()
public static var sharedLocator = ServiceLocator()