Types conforming to multiple protocols in swift

This should work:

var identityToken: NSObjectProtocol & NSCopying & NSCoding 

Note you have to use NSObjectProtocol instead of NSObject in swift.

Here are some additional examples:

Array of objects conforming to multiple protocols:

var array: [NSObjectProtocol & NSCopying & NSCoding]

Function with a parameter that conforms to multiple protocols:

func foo(param: NSObjectProtocol & NSCopying & NSCoding) {

}

For Swift version before 3.1, use:

var identityToken: (NSObjectProtocol, NSCopying, NSCoding)

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)