Top "Swift-protocols" questions

Protocols specific to the Swift language

How can I make a weak protocol reference in 'pure' Swift (without @objc)

weak references don't seem to work in Swift unless a protocol is declared as @objc, which I don't want in …

swift delegates swift-protocols
Swift - class method which must be overridden by subclass

Is there a standard way to make a "pure virtual function" in Swift, ie. one that must be overridden by …

swift abstract swift-protocols
Protocol can only be used as a generic constraint because it has Self or associatedType requirements

I have a protocol RequestType and it has associatedType Model as below. public protocol RequestType: class { associatedtype Model var path: …

ios swift generics swift2 swift-protocols
What does "Protocol ... can only be used as a generic constraint because it has Self or associated type requirements" mean?

I am trying to create a Dictionary (actually a HashSet) keyed on a custom protocol in Swift, but it is …

swift generics xcode6 swift-protocols
How to make an enum conform to a protocol in Swift?

Swift documentation says that classes, structs, and enums can all conform to protocols, and I can get to a point …

swift enums swift-protocols
In Swift, how can I declare a variable of a specific type that conforms to one or more protocols?

In Swift I can explicitly set the type of a variable by declaring it as follows: var object: TYPE_NAME …

ios objective-c swift swift-protocols
Arrays of Generics in Swift

I've been playing around with arrays of generic classes with different types. It's easiest to explain my problem with some …

arrays swift generics swift-protocols
Can I have an init func in a protocol?

When I try to implement my protocol this way: protocol Serialization { func init(key keyValue: String, jsonValue: String) } I get …

swift initialization protocols swift-protocols
Usage of protocols as array types and function parameters in swift

I want to create a class that can store objects conforming to a certain protocol. The objects should be stored …

ios swift generics swift-protocols