Skip to content

Instantly share code, notes, and snippets.

@paweljankowski
Last active March 22, 2016 18:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save paweljankowski/a510a52afce4b40a3279 to your computer and use it in GitHub Desktop.
Save paweljankowski/a510a52afce4b40a3279 to your computer and use it in GitHub Desktop.
Swift arrays
import Foundation
protocol Foo: AnyObject { }
class Bar: Foo { }
let z = NSSet(array: [Bar(), Bar()])
let x = z.allObjects as? [Foo]
if x != nil {
print("Success")
} else {
print("WTF???")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment