Foundation , NSFastEnumeration, Swift Sequence... .
- ObjC Swift NSFastEnumerationIterator:
extension Foo: Sequence {
public func makeIterator() -> NSFastEnumerationIterator {
return NSFastEnumerationIterator(self)
}
}
NSFastEnumerationIterator ( ObjC) , , , . , ( ):
var foo: Foo = Foo()
for y in foo {
print("Got a y.")
}
... y Any. foo, :
for y in foo where y is String {
print("Got \(y)")
}
, ObjC, , - " Objective-C ", SE-0057. - ObjC .