-
Swift is modern, type-safe, expressive, performant
-
but Objective-C remains a first-class citizen
-
Same design patterns, Cocoa APIs
-
"We do not want you to rewrite or stop improving your existing code!"
-
Should you use
unowned
orweak
for delegates? -
To expose Objective-C to Swift, use a bridging header
- A value of class type in Swift is never nil
var fileModificationDate: NSDate!
- Objective-C does not have a notion of a "never-nil" pointer
!
is an implicitly unwrapped optional- can be tested explicitly for nil
- can directly access properties/methods of the underlying value
- can be implicitly converted to its underlying value
WWDC 2014 Brain Lanier
- Cleaner alternative to using sentinels (
NULL
,NSNotFound
, etc.) to represent invalid values - optionals are initialized to nil by default
var optionalNumber: Int?
nil
is a sentinel value that works with any type- value is wrapped in optional by setter
optionalNumber = 6
Drag from an existing node to add a new node or link. Click to select/deselect nodes/links. Hit the DELETE key to remove the selected node or link. Drag to pan. Scroll to zoom.
Built with D3.js.
Drag from an existing node to add a new node or link. Hit the DELETE key to remove the selected node or link.
Built with D3.js.
NewerOlder