S Link
Join us at Swift Summit SF!
Swift Summit in San Francisco is a must-attend event for iOS developers. Hear from Chris Eidhof, Natasha Murashev, Andy Matuschak, Daniel Steinberg and ~20 other prominent speakers at the 2 day conference. Learn new things, make new friends, and give your Swift career a leg-up. There are rumors of a 🎤Karaoke 🎤tradition at the after party, too :)
Early bird pricing ends today Monday the 31st August, but readers of This Week in Swift can use the code "RobotFriends" to get a $100 discount on the regular price. Student pricing is also available!
Swift Showcase - Call for projects (and win tickets to Swift Summit!)
The Swift Summit SF team is putting together a showcase of interesting Swift projects from the community at Skilled.io. If you've been working on something in Swift, apply to the showcase to get coverage and community appreciation for your work.
4 randomly selected applicants will win free tickets to Swift Summit in San Francisco!
Swift Around the Web
Fun with Functions
Love this blog post. It starts out pretty simple, explaining function basics and then grows into a very elegant solution for combining a few functions using currying and operator overloading. Both are things I tend to avoid in my code, but this makes it so elegant, I'll have to use it if the opportunity comes up!
Struct Semantics in Swift
Apparently having an immutable Cocoa object is not enough to make it truly immutable - yay reference types! @chriseidhof shows off a technique you can use with structs to make sure your Cocoa object is in fact truly immutable, all with an efficient copy of the object included so you don't have to remember to do it yourself every time. Cool stuff.
Coding
Reducing FOOMs in the Facebook iOS app
- FOOM = "Foreground out of memory" crash
- BOOM = "Background out of memory" crash
"From the user's perspective, a foreground OOM crash (FOOM) is indistinguishable from a native crash. In both cases, the app unexpectedly terminates, appearing to vanish, and the user is taken back to the home screen of the device. If the rate of memory consumption increases drastically, the application can be killed without receiving any signal that memory is running out. "
Great summary of this from @sandofsky's tweet: "If you take anything away from this article: Facebook cares about background crashes, but most users won't notice."
Generic UIViewControllers
I personally find this to be a bit of an over-architecture and something that would be a problem later on when you want to have slight differences in the view controller between two different data types. But I love the exploration / idea of it. It's always fun to see the power of Swift in these type of posts. I love the way it makes me challenge my default thinking.
Apple News
Xcode 7 beta 6 Now Available
This is expected to be the last beta before the big September 9th expected GM RELEASE!!!! And lot's of cool Swift changes here, including the addition of try?
, powerful printing, static computed properties in protocol extensions, auto-completion of enums using dot-syntax (finally!), and more! 🎉🎉🎉
You can read the Release Notes here and/or check out these great summaries of the changes by these incredible Swifters:
Design
Do not let your user see spinners
A great explanation (with code samples!) of the Optimistic UI Model. Let the users comment, like, etc on the UI without waiting for the post request to come back as success from the API, and most importantly, without spinners!
Compression Resistance & Content Hugging
Yes, I'm still confused by which one is which! Here is a great visual to go with this article.
Other Cool Stuff
In Case You Missed It
Swift 2.0: Let’s try?
When I read the Xcode 7 Beta 6 Release Notes, I got immediately excited by three things, and very confused by the first and most important change in Swift - try?
! That is, until @allonsykraken showed me how I could refactor my JSON Parser with it...
A Beautiful Solution to Non-Optional UIImage Named in Swift
This weekend, I got around to watching the Swift in Practice WWDC15 Session, and I LOVED the suggestion for dealing with hard-coded UIImage names in Swift. Here is what I learned...
Tutorials
Swift Interview Questions and Answers
I wouldn't recommend using these as actual interview questions, but I had fun going through these myself to test my own knowledge of Swift lol.
Videos
Swift in Practice
Watch from 19:50 for the really good stuff! How to deal with UIImage
and UISegueIdentifier
in a compile-safe way. Get into the habit of letting the compiler help you. Love this!
WATCH
Getting Data to Your WatchOS 2 App
Finally! A blog post that explains how sharing data between your iOS app and your WatchOS app works in plain English. Thank you @parrots!
Swift Code
SIFloatingCollection_Swift - SIFloatingCollection is a component that provides logic similar to Apple Music genres selection.
ModelRocket - An iOS framework for creating JSON-based models. Written in Swift.
Butterfly - A lightweight library for integrating feedback module elegantly
TKSubmitTransition - Animated UIButton of Loading Animation and Transition Animation.
PullToBounce - Animated "Pull To Refresh" Library for UIScrollView.
Swift Thoughts
This week, I had an explosion in my brain 💥. I've been working with Swift since it came out, and I've been following and listening and reading from the best people in the industry about functional programming and immutability, and Swift 2.0 has added protocol extensions.
All these pieces of information were floating in my brain as one-offs, until they finally collided and things are a lot clearer for me now. I feel like I finally understand the true power of Swift, still knowing that while I've reached one level of understanding, I still have a few more levels to go. It's an exhilarating journey.
With that, I'd like to leave you with a tweet from @soffes that stood out to me this week:
OH: "shipping swift isn’t enough. you have to ship good swift"
Don't just strive to write Swift for the sake of writing Swift. Go beyond and learn to write good Swift. It's going to be hard - you'll have to think a lot vs falling back into your comfortable existing patterns, but it's going to be addicting once you start seeing how fun and powerful rewiring your brain is.
Happy Learning!