S Link
Migrating to Swift for iOS Developers
5-day class for iOS developers: Migrate your own Obj-C app to Swift, and explore new iOS 8 features. First class led by Homebrew pro developer Max Howell.
Swift Around the Web
Avoid using var with this one weird trick
Good reminder of the power of initializing a constant (or variable) with a function that's executed once. Of course there could be a better solution for this painful use-case in Swift (maybe Swift 2.0?).
How I Handle Optionals In Swift
I know there is a lot of pain that comes with Optionals in Swift, but you'll like them too eventually :) This is a great post for those who are starting out with Swift and are looking for Optionals tips and tricks without the pain of figuring this out yourself!
Swift: The quiet affair of the failable initializer and the nil coalescing operator
@sketchyTech discusses the pros and cons of using failable initializers in combination with the nil coalescing operator. Seems logical to use them together, but it all comes down to whether you want to treat an object that failed to initialize as an error to the user. And sometimes it's not that clear cut. Definitely something I've been thinking about a lot in my own code.
Coding
Today Extensions Tutorial in iOS8 with Swift
Ok, so Apple is rejecting (and re-approving) a bunch of Today extensions, so it's pretty crazy to develop one, but if you must, this is a good tutorial to get you started.
NSUndoManager
Did you know there is a whole Undo Architecture built into the Cocoa API? I didn't! This is a great post by @kattrali explaining how it all works.
Apple News
Xcode 6.2 beta 3 Now Available
From the Release Notes: "The @IBAction attribute is now supported for WKInterfaceSwitch or WKInterfaceSlider objects in Swift". I tried this, and while this is still somewhat buggy, it does work.
Other Cool Stuff
for i in 0...119{print(i>109 ?i>117 ?"🎁":" ":i==9 ?"🌟":i%11==10 ?"\n":i%11<(10-(i/10)) ?" ":i%17==1 ?"🎅":"🎄")}
Playground this code. Do it!!!!
Videos
Simple Made Easy
Since Swift takes us a bit away from the purely Object-Oriented side of things, this is a good reminder that it's time to pause and re-think whether our existing go-to coding patterns are "simple" or whether we're using them because they're "easy".
Functional Voodoo
Adopting map() & reduce() in Swift
"The purpose of this article is show some common uses for these functions in your every day programming. We're going to focus on map()
and reduce()
in particular, and explore some basic ideas as well as some more concrete examples." Dive in >>>
Lightweight API Wrappers
Simplify the Foundation’s JSON serialization API +JSONObjectWithData:options:error:
method with a simple wrapper to avoid the annoying AnyObject? casting. "The bottom line is: Swift makes it very easy to define such wrapper functions to make our application code more clear and simple. Use them liberally."
WATCH
konstantinkoval/WatchKit-Apps
@konstantinkoval has open sourced his WatchKit experiments on Github (all in Swift!). Check out Time Color - this is the time app I want to use!
Immediacy
@_DavidSmith gives us a good reminder of how fast our WatchKit app has to work and some tips for conquering swiftness. This is especially crucial (and hard) to understand while we're working with the nice Watch Simulator that just works instead of the real hardware.
WatchKit
Slides from a great WatchKit overview presentation by @jblocksom from his talk at CocoaConf Atlanta.
Swift Code
EasyCast
Makes math operations in Swift easier by adding automatic casting between Int, Float, CGFloat, and Double
Swift Thoughts
Happy #Swiftmas!!! The @realm team has sent out these incredible Swift ornaments, which was honestly the highlight of my week. The photo above of the ornament was posted by @SwiftLDN (hope they don't mind, but it's a gorgeous photo!).
Since we're in the final stretch of the year, here are some compilation Swift resources to take a look at as you're getting ready for the next Swift Year!!!!
- Favorite Swift Tips & Tricks of 2014 via @realm
- Swift: Blogs of Note 2014 via @sketchyTech
- Swift Unit Testing Resources via @andrewcbancroft
It's officially the slow news season, so I'll be taking a break from this newsletter next week. Happy #Swiftmas and see you next year!