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
Immutable Types with Changing State in Swift
"Immutability and changing state was a real struggle for me. The two seemed contradictory actually. How am I supposed to handle changes with things that can’t change??!" I've been having a hard time with this as well, but getting a hang out it! Another great way to deal with immutability is by using values instead of objects. The example that @andrewcbancroft provides in this post is built into the struct's mutating function behavior.
Swift: Associated Types
@xenadu02 works through the practical side of type theory where he exposes the Ugly Truth: "There's a major gotcha with abstract type members: Swift won't actually let you declare them as variable or parameter types because that would be useless. The only place you can use a protocol with associated types is as a generic constraint."
Coding
Finite States of America
@khanlou walks through a great example of using a state machine to separate an "object's path through the states from what the object actually does when transitioning to those states". I haven't thought of writing my code this way, but it's definitely cleaner and much easier to reason about than the widely-used first version he shows as an example.
Swift, Core Data, and unit testing
I haven't worked with Core Data in Swift yet, but the types of bugs that @jesse_squires encounters for his Core-Data-based Model by first using the basic Objective-C patterns we're used to does not look fun... Glad he found at least one solution. This is a good reminder that "Cocoa may be dying, but it certainly isn't dead yet. As we face these kinds of challenges with Swift, it is important to remember that the Objective-C way is not always the Swift way."
Design
Twitter's Gold Start Animation
@anildash: "Twitter added a delightful animation to the gold star every time you favorite a tweet, but described it like THIS?!" Make sure to favorite this tweet on your Twitter app if you haven't already. So much fun. But seriously, a good reminder to write better release notes.
Designing the Lyft Split Payment Experience Using Pixate and Framer
"Prototyping was a crucial part of our design process for exploration and iteration, gathering feedback from stakeholders, and communicating the details of implementation to our Engineering team."
In Case You Missed It
Mutating Functions in Swift Structs
I’ve started working a lot more with Swift Structs, especially as I’m learning more about functional programming. I remember when Swift first came out, I was super confused about why the compiler made me insert the “mutating” keyword for my functions in structs. However, now after reading a bunch about value vs reference types, it’s starting to make a lot of sense.
Tutorials
LiquidFun Tutorial with Metal and Swift - Part 1
In this LiquidFun tutorial series, you’re going to learn the basics of making procedurally animated 2D water.
Videos
What’s new in iOS 8 for hamsters
Ok, so the name of this is a little weird, but it's hilarious once you watch the video! This talk is full of cool and pretty obscure tips and tricks for iOS8. It's less than 25 minutes total, so definitely worth watching!
Functional Voodoo
Proof in functions
Writing Generic functions could seem intimidating to noobs like me, but @mbrandonw's elegant post shows off how in fact the compiler is pretty much telling us the implementation.
"For every function we could implement there is a corresponding mathematical theorem that is provably true. The converse is also true (but a little more nuanced): for every true logical theorem there is a corresponding generic function implementing the proof."
I highly recommend watching @mbrandonw's Functional Swift Conference talk after reading this!
Phantom Types
This week's Functional Swift Snippet walks through creating types solely for the purpose of safer and more readable code - so you can have the compiler check errors for you, rather than having the code fail at runtime.
Functional Education
As many of you know, I've been recently working on learning Functional Programming to become a better Swift developer. The more I learn about it, the more value I see in it. But it is definitely a very hard topic to learn. This post outlines the problems with how functional programming is currently taught, and provides a list of resources for those learning, including a strong analysis on what's missing from each resource and whether it is recommended. Looks like I should try out UPenn's CIS 194: Introduction to Haskell next!
WATCH
Make Animations for WATCH Using iPhone
@andydrizen recreates WATCH’s activity indicator animation on the iPhone using code (yay Swift!), then uses the UIView Recorder to capture the images of the animation at 60 fps, which he then uses to recreate the animation on the WATCH. Genius!
AppleWatchSBB
Open Source: A simple app for the coming Apple Watch to access the SBB (Swiss railway) timetable information. Quickly look at departures of nearby stations or get a connection to get directly home.
Bezel
"Bezel is a free developer tool for Apple® Watch™ developers who are running their apps in the iOS Simulator. It shows a window that looks like an Apple Watch and projects the contents of the Simulator’s watch window into it so that you can see what your app will look like in the context of a device frame surrounding it (the amount of extra black margin that it will have, etc.)."
I just downloaded this and cannot imagine developing for the Apple Watch without it! The other great thing about Bezel is that it allows you to see your app in the actual size (not the 2x retina size), so you can get a better feel for what your app will actually look and feel like to the user on a tiny device. Oh yeah, and you can have lots of fun changing the wrist band frames around your watch :)
Podcasts
Inquisitive #21: Exploit the Constraints
Great in-depth insights about development for the Apple Watch from @_DavidSmith. While I've been waiting until the Watch actually comes out to start using it as my only wearable, David Smith has bought a bunch of competitor brands on the market to get a feel for the user interactions and use-cases. Smart! One surprising insight is that having the watch actually reduces the FOMO anxiety we feel from possibly missing that our phone vibrated in our pocket.
Swift Code
PulsingLayer
Adds a customizable CALayer halo effect to any arbitrary UIView. Completely written in Swift.
ArtSabintsev/Siren
Notify users when a new version of your iOS app is available, and prompt them with the App Store link.
Swift Thoughts
I attended the first Swift Meetup of the year in San Francisco last week, and the turnout was incredible - several people had to stand! I'm excited to see so much enthusiasm and excitement around Swift in 2015!!
The Meetup featured and incredible speaker - Andy Matuschak of Khan Academy (formerly on UIKit team) who expanded on his talk at the Functional Swift Conference. The key is to put action-based code in the Object Layer and actual logic in the Value Layer.
Andy uses the zoetrope as a powerful analogy - each picture on it's own (the value) is dead, but when you stare at one point and rotate the zoetrope, you get motion. In other words, an object is the representation of certain values at a specific points in time. Of course Andy put it all a lot more elegantly than I can write here! Luckily, the talk was recorded, so I will definitely post it on here once it's out.