Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Forwarding calls to in ObjC to internal swift methods
@objc public class TSCDevice: NSObject {
internal let mySwiftObject = Device()
override public func forwardingTargetForSelector(aSelector: Selector) -> AnyObject? {
if mySwiftObject.respondsToSelector(aSelector) == true {
return mySwiftObject
}
return super.forwardingTargetForSelector(aSelector)
}
override public func respondsToSelector(aSelector: Selector) -> Bool {
return super.respondsToSelector(aSelector) || mySwiftObject.respondsToSelector(aSelector) == true
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.