≈ the.bay.news

Using SF-0011 with protocols

Swift Forums
Using SF-0011 with protocols
Because conformance to AnyObject is not the same as subtyping of any AnyObject, SF-0011 does not allow to use existentials of AnyObject-constrained protocols as Subject, unless they are marked as @objc. protocol MySubject: AnyObject { } struct MyMessage: NotificationCenter.AsyncMessage { typealias Subject = any MySubject } class C: MySubject { private func notify() { // error: No exact matches in call to instance method 'post' NotificationCenter.default.post(MyMessage(...

0 comments

Sign in to join the discussion — your thebay.events account works here.

No comments yet.