在 Swift 3 中声明具有类型要求的协议

Declaring a protocol with a type requirement in Swift 3

如何声明一个 属性 像这样:

import SpriteKit

protocol Pausible where self is SKScene {
    //var isPaused: Bool { get, set }
}

其中 属性 要求它只能符合某个 class 和/或 class 的 class?

更新: 似乎在 Xcode beta 5 中,Apple 改变了它在 Swift 3 中的显着表现,目前还没有关于它的文档。可能只是该功能当前已损坏。

您不能根据符合协议的类型更改协议的要求。

您可以为协议扩展添加限制,但不能为协议添加限制。