Swift Around the Web
The Right Way To Write a Singleton
I already knew that the newest and coolest way to do a singleton in Swift was the nice static let sharedInstance = MySingletonClass()
inside the class, but I honestly didn't fully understand this until reading this blog post with the behind-the-scenes explanations of what's going on.
And yes, for all of you thinking it, I do realize that in an ideal world, we wouldn't be writing any singletons. Here is a great talk from @jspahrsummers on how you can get rid of the singleton.
Deferring and Delegating in Swift 2 (Xcode 7 beta 3)
An interesting pattern of having your setup / tear-down logic in a delegate that'll be used in your defer statements. Still wrapping my head around this...
Coding
How iOS 9's Safari View Controller could completely change your app’s onboarding experience.
One of the iOS 9's lesser known features (at least I didn't pick this one up at WWDC), is the Safari View Controller. Instead of taking the user to Safari, you can present a pre-built browser (which includes saved cookies!) to your users in your own app. But here is the cool part:
"In addition to third-party services being logged in, you can also see if YOUR users are logged into your web app already, so you can seamlessly sign them into your iOS app!"
Namespaced constants in Swift
Love this as an elegant pattern to use in Swift-based iOS apps. Hold on a minute... have to go refactor my code right now.
Other Cool Stuff
In Case You Missed It
Swift Thinking
The video from my AltConf 2015 Talk is up! Discussing patterns learned over the past year working in Swift. Enjoy!
Videos
Books
Functional Voodoo
Swift Functors, Applicatives, and Monads in Pictures
One of the best (and beautiful) resources for learning more about some of the most complicated functional topics is the Functors, Applicatives, And Monads In Pictures post by @_egonschiele that I've linked to previously.
Well, you're in for a big treat! @mokagio translated the original Haskell version into much easier-to-understand Swift examples. Enjoy!
WATCH
Chart of Apple Watch Complication Types and Layouts
So Complications might be a little complicated after all... Super useful chart of all the possible combinations. Thanks @WatchKitSources for pointing it out!
Using WatchKit with Firebase
If you're using / thinking about using Firebase as the backend for your app, this is very detailed docs on how to use Firebase with WatchKit. Also useful to look through this to understand how to structure your Watch App in general.
Swift Code
tispr-card-stack - Tinder-like card UI built on top of UICollectionView.
Font-Awesome-Swift - Font Awesome swift library for iOS.
ParkedTextField - A text field with a constant text/placeholder
DOFavoriteButton - Cute Animated Button written in Swift.
BTNavigationDropdownMenu - The elegant dropdown menu, written in Swift, appears underneath navigation bar to display a list of related items when a user click on the navigation title.
Business
Objective-C in a Swift World
"If you stick to Objective-C, there are three ways things could play out:
Swift fails and goes away: Good job! You were a mature engineer and saved your company time, money, and risk.
We’re stuck in a two-language world: You may miss out on some great opportunities.
Swift succeeds: Objective-C is the new Cobol. If you enjoy legacy apps, you’ve got job security until the heat death of the universe."
Which one are you betting your business on?
Why 'Assistant-As-App' Might Be the Next Big Tech Trend
I love the combination of technology + human in the Assistant-As-App business model. The phone collects / provides the necessary data for the human assistant to make the most intelligent analysis / decision / advice - leading to a much better result in the case of the nurse assistant than going to a doctor who doesn't know much about you and doesn't have the time to really work with you to solve your problems.
Swift Thoughts
This week, I've been reading the Tao Te Ching for morning inspiration, and chapter 11 really stood out to me in relation to the Apple Watch:
We join spokes together in a wheel, but it is the center hole that makes the wagon move.
We shape clay into a pot, but it is the emptiness inside that holds whatever we want.
We hammer wood for a house, but it is the inner space that makes it livable.
We work with being, but non-being is what we use.
The Apple Watch is about us NOT using it. The good apps are ones that collect data in the background, freeing us from spending the time on entering information manually (looking at you Activity App!). They are the ones that notify us only when something is urgent in a particular context, freeing us from constantly checking our phones and allowing us to be present in the world around us (thanks Maps!).
When designing your Watch App, think about the value it provides when NOT used.