Last active
August 29, 2015 14:16
-
-
Save below/475cdfd44550496e0aff to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
protocol myProtocol { | |
func dothatthing () -> Void | |
} | |
var array : [protocol<myProtocol>] = [] | |
class A : myProtocol { | |
func dothatthing() { | |
println("Class A") | |
} | |
} | |
let foo = A() | |
let bar = A() | |
array.append(foo) | |
array.append(bar) | |
for x in array { | |
// The following does not compute | |
if x === bar { | |
println("We got it!") | |
} | |
else { | |
println("We have not it") | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
import UIKit
protocol myProtocol {
func dothatthing () -> Void
}
var array : [protocol] = []
class A : myProtocol {
func dothatthing() {
println("Class A")
}
}
let foo = A()
let bar:A = A()
array.append(foo)
array.append(bar)
for x in array {
// The following does compute
}