iOS Weekly Minute - May 12, 2018
Big Announcements
Well, it's not huge news, but Apple's about to start requiring apps to be built with the iOS 11 SDK. They do this every year, reasonably close to WWDC, but different this year is the requirement that "all iOS app updates submitted to the App Store must ... must support the Super Retina display of iPhone X." This is big news if it means that apps now need to support the edge to edge display of the iPhone X. If you haven't already, now seems like a great time to start updating your apps to support the iPhone X. Maybe this finally means we'll get versions of Google's apps that support the iPhone X. 😂
In other non-Apple but fully awesome news, both Microsoft and Google hosted their respective developer conferences this past week. Not much came out of Build that seemed interesting to me, so if ya'll got some juicy bits, let me know!
Among the Google I/O announcements I'm looking forward to are trying out Jetpack, kicking the tires on the newly announced MLKit with Firebase integration, maybe dabbling with the newly fused ARCore for Android & iOS, the updates to the Material Design Components for iOS, and digesting the new Flutter videos. As a user I'm pretty jazzed about the new Linux support coming to Chromebooks (which will eventually include Android Studio 😲), seeing how well Google's gesture controls work in comparison to the iPhone X, the amazing new Lens app, and clearly I'll have to try Duplex...
Articles I'm Reading
Swinjecting a Large Project
Derek Clarkson writes about how to use Swinject in a large app, with some good tips and tricks along the way. I use Swinject, but not in this way, and I didn't actually know about the storyboard support for view controllers. I'll definitely be using this article as a reference if I need to update my existing Swinject implementations, or any new larger projects I start.
Dealing With Dates
Every now and again, I think all iOS developers need reintroduced into handling dates, and the vagaries therein. Writing for Martiancraft's Syndicate, Richard Turton takes us back down memory lane (or... imprints new memories) and reminds us that:
[A Date] only holds one piece of data - a number of seconds. ... A Date does not contain any information about months, days, years, hours, minutes, or time zones.
🤔
Swift Tip: Unwrapping Solutions
Erica's poll on Optional unwrapping solutions wasn't intended to purvey a Swift tip, but I took one away anyway! Unwrapping an optional is something that Swift developers do on a very frequent basis. But, sometimes you really need a value to be present for that optional, and if there isn't a value present, you really can't continue on with the program execution.
Typically, in various Swift codebases, you'll see something like:
// Bad
let viewModel = Container.resolve(MyViewModel.Self)!
// Better
guard let viewModel = Container.resolve(MyViewModel.Self) else {
fatalError("Yeah... gonna need a view model here, mmk, thanks.")
}
...
In the above, we declare that we require the view model to resolve to continue execution. However, in the "bad" version we're not really declaring why we 1) need this thing and 2) how or if we can guarantee that the view model will always resolve. This gets a little better in the "better" version, but it's all too easy to slip in the former "bad" version. It's also quite verbose and having this pattern repeat can lead to a littering of guard let
expressions everywhere.
But! The bang bang operator proposal is here to save us.
If the !!
operator is accepted, we'll be able to turn the above example into something like:
// Optional's Best Life
let viewModel = Container.resolve(MyViewModel.Self) !!
"Dude... where's my view model..."
This is 1) more concise, 2) follows the same pattern as the existing force unwrap, and 3) still does it what we need it to: convey meaning while enforcing program correctness. 👩🔬
Tool of The Week
quicktype
Yes... it took a Kotlin article for me to find out about the amazing quicktype tool for generating model and (de)serializer implementations from just pure JSON. The tool supports a variety of languages, including both Swift and Kotlin. The Swift version generates some very nicely structured Codable
implementations, along with some optional client implementations (URLSession
and AlamoFire
). And, you actually don't need to download anything since they host a really nice playground editor for generating implementations. But, they do also have a handy dandy Xcode plugin at the ready. 🛠
Videos I'm Watching
Google I/O 2018 Keynote in 10 minutes
Google compressed this week's I/O keynote into a very digestible 10 minute clip. I love this because it's so easy to miss all the exciting announcements in the full-length version. This way, you get all the excitement without all the drudgery.
Code beautiful UI with Flutter and Material Design
I suppose I'll keep on this Flutter train I got going, and share Google's I/O Flutter with Material Design video. It is quite compelling to see an app come together with some material Flutter components along with the magic of Flutter's hot reload. Very nice 👌.
And that's all folks! Thanks for making it this far, and stay tuned for next week! I appreciate feedback, so if ya'll got some thoughts, get @me or let me know in the comments.