Skip to content

Instantly share code, notes, and snippets.

@amichnia
Created February 16, 2019 14:47
Show Gist options
  • Save amichnia/7be82697478ec980cdd19ca6a867bc66 to your computer and use it in GitHub Desktop.
Save amichnia/7be82697478ec980cdd19ca6a867bc66 to your computer and use it in GitHub Desktop.
...
@objc(Factory)
internal class Factory: NSObject {
private static var privateClassType: MyPrivateClass.Type!
@objc static func registerPrivateClassType(type: MyPrivateClass.Type) {
print("REGISTRATION CALLED WITH TYPE = \(type)")
privateClassType = type
}
func createMyPrivateClass() -> MyPrivateClass {
print("FACTORY METHOD CALLED TO CREATE INSTANCE OF \(String(describing: Factory.privateClassType))")
return Factory.privateClassType.init()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment