3 min read

Issue #55

Hi there, welcome to the 55th issue of iOS Code Review!

Over the past two weeks, I had the privilege of attending iOSDevUK and speaking at NSSpain. It was an incredible experience! My talk, titled "Crafting Swift Code that's bug-free by design", was recorded and will be available in the coming weeks - I will share it with you then.

I would like to take a moment to express my warmest welcome to those of you who I had the pleasure of meeting at iOSDevUK and NSSpain, and to everyone who have joined the iOS Code Review community recently. Your presence and engagement mean the world to me ❤️

Today I'm excited to share a few learnings that caught my attention at the conferences.

Sponsor of the week: Paste

Paste is a productivity app for Mac and iOS devices that amplifies the system’s clipboard capabilities. It’s a go-to tool for thousands of developers who aim to speed up their daily workflow.

Today we're launching Paste 4.0, ready for iOS 17! It has been rebuilt from the ground up, offering enhanced performance and a unified user experience across all platforms.

Try for free 😎

Cache vs Persistent store

Avi Tsadok talked about building offline-first apps. When we build offline support in our app, it's important to note the difference between caching and persistence. Caching is temporary and it's main purpose is to boost performance and perceived speed of the app. Persistence, on the other hand, allows to operate on the data in offline, providing full offline capability to the app. So before we reach to pick a storage solution, we should understand - are we adding caching or persistence?

Simple app architecture

David Kababyan shared the architecture behind the iOSDevUK conference app. That was a lightnign talk, and the architecture seems nice for a small app like that!

Working with time

Dave DeLong gave an insightful talk about working with dates, drawing an analogy with coordinates on the map. There are real places (points in time), and there are their names in a certain coordinate system or in a certain address system (epoch time, date representation in different calendars or time zones).

What I found particlularly interesting is the difference between setting and offsetting time. When we want to compose a date that means 3 am on a certain day, we have two ways of doing it:
- get the day and set its hour to '3 am'
- get the day's start (midnight) and add 3 hours.
The first might not exist, and the second will always exist.

And it's worth remembering that sometimes we don't need to bother, and 24*60*60 might be fine, for example if we're talking cache expiration.

James Dempsey and the Breakpoints

NSSpain wrapped up with a bang - a performance by James Dempseys' country band - James Dempsey and the Breakpoints. The only band out there that sings about Swift Development 😄 check them out!

James Dempsey and the Breakpoints - Backtrace

and, Swift 5.9 is here!

This is a major new release that introduces macros to Swift, adds bi-directional interoperability with C++, and more. Read the blog post to see what's new.

Using if and switch as expressions is something many have waited for. Let's just try avoid writing code like this (via @krzyzanowskim):

Alright, that's it for today! Let's spread the good code vibes ✨🧘🌈☀️
Thank you to friends at Paste for sponsoring this issue ❤️

What was particularly interesting? let me know by replying!