Last active
July 22, 2016 14:36
-
-
Save maxcampolo/032beb998a7eace9b554b3927bc3f956 to your computer and use it in GitHub Desktop.
Just some notes about the intricacies of the swift language.
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
// 1.) Swift selectors must have @objc if they are not exposed to objective-c (i.e. they are private to a swift class) | |
// 2.) Make a failable initializer by adding an optional (?) after initializer (init?()) | |
// 3.) To cast in a for in loop use "case". Use "where" to unwrap optionals or check a condition. | |
for case let button as AClass in view.subviews { | |
} | |
for view in childViews where view is UIButton { | |
} | |
for case let view as MyCustomView in self.view.subviews { | |
view.removeFromSuperview | |
} | |
for number in numbers where nubmer % 2 = 1 { | |
} | |
for optional in optionals where nubmer { | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment