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
Swift Failable Initializers
This is a great reminder that even though failable initializers are a thing now, they should be used very sparingly: "failable initializers misplace responsibilities in your architecture, or at least encourage you to do so. Specifically, they misplace the point of failure. An initializer should construct an instance. It should be as simple as possible. It should provide appropriate default values when feasible. It should not be processing or parsing data, as those responsibilities are for functions or instance methods. And most importantly, it should succeed. Of course, there will be exceptions but they should be few."
Swift Optimisation Again
Here are some of the golden tips from @jl_hfl's slides at the Swift London meetup last week. Check out the full slides for more!
- Avoid non-local mutable state (compiler can’t optimise)
- Don’t be afraid to copy/pass data by argument - the compiler can optimise it out out. Copies happen if needed and are fast
- Pure functions are best - run in parallel, no global state to interfere with optimisation
- Structs are fast - raw memory, often on stack
- Use constants (declared with let)
- Consider different algorithms - often the biggest win
Drawing with Text
Here are some fun code katas for improving your Swift skills. I bet you can come up with better solutions than the ones provided in this blog post! Hint: this looks like some fun practice for functional programming.
)
Coding
Detect Shake Gesture in IOS8 with Swift
Shake shake shake, shake shake shake, shake your iPhone! I bet you can think of some fun apps your can make to take advantage of this shake gesture :)
Apple News
Swift
Swift now has an official Apple landing page! And of course someone has already used it to make a pretty funny meme. But seriously, this really shows off another level of Apple's commitment to Swift.
Failable Initializers
"Failable initializers eliminate the most common reason for factory methods in Swift, which were previously the only way to report failure when constructing this object... which simplifies the language by eliminating the confusion and duplication between initializers and factory methods"
64-bit and iOS 8 Requirements for New Apps
In case you were planning on prioritizing other features first... "Starting February 1, 2015, new iOS apps uploaded to the App Store must include 64-bit support and be built with the iOS 8 SDK, included in Xcode 6 or later."
TestFlight Beta Testing
TestFlight Beta Testing is officially LIVE!!! "You can invite up to 1,000 external testers using just their email address."
Other Cool Stuff
James Dempsey and the Breakpoints
Songs about iOS Development by iOS Developers. What could be better?!!
In Case You Missed It
Last week, I had the pleasure of speaking about HealthKit at the Wearables + Things conference, which took place in the beautiful Artisphere near Washington, D.C. To my surprise, my talk was in a Dome-shaped IMAX Theatre!
Anyway, for those who missed it, I'll be re-mixing my HealthKit talk at NSMeetup in San Francisco on November 5th. Sign up if you haven't already!
Swift: Failable Enums with Optionals
This is a discussion of how to handle enum initialization from an optional value given the new (and breaking) changes for enums in Swift 1.1. Would love to get ideas for better solutions to this!
How To Find A Substring In Range of a Swift String
Swift Ranges are wildly different than NSRange in Objective-C. I therefore find myself always spending way more time working with Swift Ranges than I ever think I would! Of course, in retrospect, Swift Ranges make a lot of sense, but they’re hard to work with out of the box.
Tutorials
Videos
Swift and Objective-C: Best Friends Forever
Watch this talk to save yourself hours of debugging in apps that use both Swift and Objective-C (aka most apps today). While the two languages play very nice, there are definitely a few gotchas to watch out for!
Functional Voodoo
Functional Functions
Still confused about what Functional Programming actually is? @richturton provides code samples with detailed explanations. Here is some of what makes a function functional:
- It doesn’t depend on anything that isn’t passed in
- It doesn’t affect anything except the return value (though this is the case for both methods here)
- It doesn’t even need an instance. There is no reference to instance variables. The functional version could be a class method or a standalone function, whereas the non-functional version has to be an instance method.
- When called with the same parameters, it will always give the same results
Functional Quicksort
Functional Snippet #3 is out! Make sure to take a look at the previous decompose snippet to fully understand what's going on.
WATCH
happywatch/watch-simulator
Can't wait a few more weeks for WatchKit to come out?!!! You can now build apps using this simple watch simulator. I used it last week during my talk on HealthKit. One of my audience members was so excited, he tried it on :)
Apple Watch Apps Concept - Complete GUI
Due to the small screen of the WATCH, I haven't completely wrapped my head around what the actual user interactions will look like. So I was really excited to see these beautiful WATCH concepts.
Heartbeat
A prototype app for the Apple Watch designed for machine learning in healthcare (using the watch simulator mentioned above!).
Books
A Swift Kickstart
This book is an introduction to Apple's new Swift Programming Language. If you are an experienced developer who knows at least one modern programming language well, then this book is designed to teach you how to think and program in Swift.
Swift Code
Pathfinder - A pathfinding library written in Swift
SFlatButton - Create a Buttons in Swift like Bootstrap 3.0
RadialTransition - Great iOS radial (circle) animation transition for navigation controller, with custom back swipe.
LogDispatcher.Swift - A more powerful println(_:)
QRCodeReader.swift - Simple QRCode reader in Swift
SuperRecord - A small set of utilities to make working with CoreData and Swift a bit easier.
DTIActivityIndicatorView-Swift - Animated custom ActivityIndicator inspired from css library SpinKit and much more. Written in Swift.
Swift Thoughts
WatchKit will officially be available to developers in November!!!!! So if you didn't have plans for the holidays, you do now :)
To be honest, part of me is secretly not as happy about the above news. There is so much more I wanted to learn / experiment with in iOS8 and Swift before the end of the year. I started the edX FP101 course to understand functional programming better, and this week I got to play around with iOS8 specific features - split view controllers, handoff, extensions, CloudKit, etc.
Of course, the endless learning is my favorite part of being a Software Engineer. Next year is going to be incredible!