Issue 46
Apr 22, 2021

Core Data Migrations: you hope you never have to write them yourself.

This week's story will tell you that our Collect app experienced many of those so-called "heavyweight migrations".

Whenever you can, you should prevent yourself from writing them. Even after 3 years of experience, I'm still fixing edge case bugs for our application related to Core Data migrations. I'm not able to explain to you how to do heavyweight migrations now but I can highly recommend reading Donny's book on Core Data which covers migrations.

What I can share with you is that our Diagnostics framework helped a lot with fixing migration issues. We've built-in an alert that allows users to share a diagnostics report whenever a migration failure occurs. The report contains a detailed error explaining to us the cause of the failure. 

You can't prevent bugs but you can prevent yourself from not having any details once a bug occurred. Our development process around fixing bugs has improved a lot since Diagnostics arrived and it even allows our support team to pre-check states like "is the user updated to our latest app" instead of dropping an issue with our team and letting us say "this is fixed in the latest release".

Enjoy this week's SwiftLee Weekly!

THIS WEEK'S BLOG POST

Lazy variables are a valuable tool to prevent doing unnecessary work. Only perform expensive operations once they're actually needed. There are a few things to consider when using these kinds of properties which are explained in this week's blog post.

SPONSORED

Our team has experience reducing the size of Airbnb’s iOS app by 10%, now we’re bringing our new development experience to apps everywhere. App size is critical to building a global presence, but you don’t have to solve it on your own. Let Emerge worry about app size, so your engineers can focus on building the features customers want.

TWEET OF THE WEEK

A great tip by Vadim Bulavin on printing out optionals without the annoying ‘Optional(…)’. While you're reading his tip, you might also want to check out his blog post on callable objects.

CURATED FROM THE COMMUNITY

CODE

It’s not a surprise to see John Sundell writing about Swift and key paths. I really like this idea of a proxy, which will come in handy in many of my projects to replace those simple proxy computed properties.
Identity Pinning helps to improve the security of your app and can make it more difficult to perform so-called Man-in-the-Middle Attacks on your app. In this post, Apple explains what Identity Pinning means and how you can implement it in your applications.
I feel sad I never found this blog by Rob Whitaker earlier than last week. It's full of valuable posts regarding accessibility and can help us make our apps more accessible. I especially like these quick-win posts that should be actionable for all of us, including your Android colleagues as he got that covered too!
While we’re at accessibility, I want to share this post by Daniel Devesa. It covers several facets of implementing accessibility features to apps. It comes with great drawings which makes it a pleasure to read and links to several other resources that can help you make your apps more accessible.
Peter Steinberger shared some interesting posts on Twitter this week regarding his journey of migrating a settings page to SwiftUI. This tweet is followed by a response from Alex, sharing a great resource about SwiftUI unit testing

OPTIMIZATION

A very interesting tool developed by the team behind Spotify. Get insights into your project's build performance across the team to know when your project's build time gets slower or improves.

PODCASTS

In this podcast, Ellen Shapiro has a great conversation with John about Framework and SDK development. Ellen did make me feel sad too as I realized we’ve not been at in-person conferences for a long time. We miss hanging out with you to Ellen!

DESIGN

Although Figma is super trendy lately, many of us still use Sketch. This week, Apple released a macOS 11 Sketch Library which we can use for inspiration or templates for Mac app designs.

NEWS

If you want to keep yourself up to date with (I bet almost all) Swift blog posts, you want to bookmark this website. It’s built on top of the iOS Dev Directory used by many newsletters to aggregate content from.