1 min read

Issue #16

Hi there,

This time I have exciting news to share - last week we crossed the 1000 subscribers mark 🥳 It's so honouring to be able to share the learnings with such a wide community from all around the world. Thank you for tuning in!

And now, let's dive into the tips 👇


Managing image assets

This is 100% my favourite way to organise assets - images or SF symbols, and even localisation strings.

The best part is that you can easily check in unit tests that none of the assets are missing (or misspelled). Just conform your enum to CaseIterable and test:

Asset.allCases.forEach { XCTAssertNotNil($0.image, "\($0) is missing") }

Use Labels in SwiftUI

Here's a nice short summary of benefits of using Label over just an HStack with Image and Text. I think we should always prefer Label. More details and examples in the documentation.

On counting characters

Few issues ago I wrote about being careful not to mix ranges from String and NSString. And here's a graphic example of how just a simple emoji is counted differently, with explanation why:

On pure functions

This is a great approach to structuring code, and it pairs well with the concept of pure functions:

Visual logging

I started using emojis in logs only recently, and it's life changing on large projects. For log levels, or just easily finding that one print statement you just added.

Memory management with async/await

This article was widely shared so you may have already seen it, but if not - definitely check it out if you're already using concurrency. The biggest takeaway: we have to remember to cancel forever-running observations, such as for await x in in publisher {...}.

Memory management when using async/await in Swift | Swift by Sundell

Managing an app’s memory is something that tends to be especially tricky when it comes to asynchronous code, so let’s take a look at how to do just that when using async/await.

🤘

Alright, that’s it for today.

I have a question for you: I'm sending this newsletter around lunch time in the European timezone. How has your experience been with that? Share your thoughts by replying to this email or by pressing the buttons below.