# Using SF-0011 with protocols

**URL:** <https://forums.swift.org/t/using-sf-0011-with-protocols/90115>\
**Category:** Using Swift\
**Tags:** generics\
**Created:** [October 16, 2026, 10:19am UTC](https://forums.swift.org/t/using-sf-0011-with-protocols/90115 "2026-10-16T10:19:14Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nickolas\_Pohilets](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/nickolas_pohilets/32/10659_2.png) [@Nickolas\_Pohilets](https://forums.swift.org/u/Nickolas_Pohilets)\
**Post date:** [October 16, 2026, 10:19am UTC](https://forums.swift.org/t/using-sf-0011-with-protocols/90115/1 "2026-10-16T10:19:14Z")

</div>

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`.

```swift
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(), subject: self)
    }
}

```
