How to Do Weak Linking in Swift

Weak Linking in IOS

For case 3 (new class in an existing framework), you do not need to weak link to the framework, but you will need to use NSClassFromString to get a reference to the Class in order to create instances of it (and remember to handle the case where it returns nil on older versions of iOS).

How do I weak link frameworks on Xcode 4?

Go to your project -> Targets -> Build Phases -> Link Binary with Libraries.

Then change the library you want to weak-link from "Required" to "Optional".



Related Topics



Leave a reply



Submit