> In my use case, I have a framework, and I want to switch developer's some > delegate object with my NSProxy standin, listen delegate method myself, then > forward to the developer's original delegate object. > > It was working without any issues for delegate objects which are Objective-C > classes. But, it fails for Swift types because dynamic casting does not work > anymore. > > So, do you have any suggestions about how can I handle this interception > functionality without NSProxy?
Make your proxy object explicitly conform to the the delegate protocol you're trying to monitor, and have it call through to the original delegate. Boilerplate-y? Yeah, totally. But Swift simply isn't designed for what you're trying to do. -- Brent Royal-Gordon Architechies _______________________________________________ swift-dev mailing list swift-dev@swift.org https://lists.swift.org/mailman/listinfo/swift-dev