Skip to content

Instantly share code, notes, and snippets.

@nevyn
Created October 27, 2015 18:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nevyn/920d4cddb6ee6ab1ce1f to your computer and use it in GitHub Desktop.
Save nevyn/920d4cddb6ee6ab1ce1f to your computer and use it in GitHub Desktop.
class Foo : NSObject {
class func shared() -> Foo {
return Foo()
}
func foo() -> String {
return "hello"
}
}
let WeakFoo = NSClassFromString("Foo");
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
let x = WeakFoo?.shared().foo()
print("Hello \(x)")
return true
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment