How about 5 new tips you can start using today? ๐Ÿ’ก

Hi ๐Ÿ‘‹

Guess what, today is my birthday! ๐ŸŽ‚ And I have a gift for you ๐Ÿ˜›

Last week I started teaching my course on Combine and the replay of the first session is available for free!

In this first session you will learn all the foundational concepts that Combine relies on ๐Ÿ‘Œ

And the course will continue this Thursday, with a second session that will focus on exploring Combineโ€™s operators ๐Ÿ› ๏ธ


One of the benefits of spending a lot of time on Twitter (or is it X now? ๐Ÿค”) is that I see a lot of iOS folks share super useful tips!

So I went through my bookmarks and made you a list of the 5 most useful tips Iโ€™ve found ๐Ÿ™Œ

#01 โ€“ Multiline line labels in SwiftUI

If your designers ever asked you to implement a multiline label, you probably remember how challenging it must have been!

But this might be a thing of the past, because iOS 16 introduced a new modifier .lineLimit() that lets you specify how many lines a TextField is allowed to span (and you can even pass a Range!)

#02 โ€“ How to lookup error codes

Debugging issues is hard, especially when the only piece of information you have to investigate is this kind of obscure error code: NSError(domain: "NSURLErrorDomain", code: -1003)

But did you know that thereโ€™s a website that lets you easily look up which constant an error code might refer to?

#03 โ€“ Property Observers x local variables

Because of their names, we tend to think that property observers can only be applied to properties.

But as it turns out, thatโ€™s not the case: they also work with local variables!

And this can be particularly useful, especially if youโ€™re debugging a complex piece of code and you want to monitor value change in a variable!

#04 โ€“ Displaying animated GIFs natively

If, like me, you ever tried to display an animated GIF in an iOS app, you might have noticed that by default UIImage will only display the first frame of the GIF ๐Ÿ˜ž

Turns out this limitation is no longer true, because thereโ€™s now an API to natively display animated GIFs ๐ŸŽ‰

#05 โ€“ Ever heard of the `for case let` syntax?

Swift is known to have quite a convoluted syntax when it comes to handling enums with associated valuesโ€ฆ

Did you know that itโ€™s possible to combine a for-in loop and an if-lettogether through the use of the for-case-let syntax?

I donโ€™t recommend using this syntax on a daily basis, but these little pieces of trivia are always worth knowing!

(just promise me youโ€™ll never ask this as an interview question ๐Ÿ˜›)

Thatโ€™s all for this email, thanks for reading it!

If youโ€™ve enjoyed it, feel free to forward it
to your friends and colleagues ๐Ÿ™Œ

I wish you an amazing week!

โค๏ธ

Previous
Previous

Discover MeasurementFormatter

Next
Next

Bad practice: capturing a method reference