Once-a-year Black Friday deals are coming. Read more.
Give your simulator superpowers

RocketSim: An Essential Developer Tool
as recommended by Apple

Issue 75
Aug 10, 2021

How to get better at writing solutions in Swift?

As you're reading this newsletter, it's likely you're interested, experienced or just getting started with Swift. You might be able to write a working application, SDK code, or even complex solutions using all kinds of Swift features.

I often get asked how I stay up to date with the latest features or how I'm able to combine and use several kinds of Swift features in one solution. I shared an article on dependency injection combining features like generics, static subscripts, and property wrappers a few weeks back, an example of combining features.

This week's article has two goals: teaching you how to throw an error if an optional contains no value and taking you on the journey I took to find the best solution for my problem. I'm learning new techniques every week, too, just by solving a problem w/o just using the knowledge I have at hand.

Sure, you can write a solution with simple techniques like guards and if let statements, but wouldn't it be more fun to explore a little further and find more advanced solutions to the same problem? It's my way of getting better at writing solutions in Swift while at the same time learning more about the features that Swift offers. Writing an article to summarize my learnings is a great way to not forget about these learnings while at the same time teaching you how to do the same.

I challenge you this week to take that extra mile and see if you can rewrite a certain solution by exploring features in Swift you didn't know yet. I bet that the new keywords navigator on the SwiftLee homepage will help a lot!

Good luck, and enjoy this week's SwiftLee Weekly.

THIS WEEK'S BLOG POST

In my day-to-day job at WeTransfer, I'm often exploring ways to improve our code in Swift. It's a great way to learn new Swift techniques by exploring solutions for the same problem. In this article, I'm taking you with me on my journey of finding the best solution to unwrap an optional or throw an error if a nil value is found.

TWEET OF THE WEEK

50x better bug and crash reports, with data collected automatically. Receive device info, steps to reproduce, stack trace, advanced logs & more with every report. Start debugging issues faster by signing up for free.

SPONSORED

Become one of the highest-paid developers by achieving an expert level of practical iOS app architecture skills. Join a series of lectures and coding sessions given by Lead iOS developers in this free online course.

CURATED FROM THE COMMUNITY

CODE

I love these deep dives by Bruno Rocha. Most of us will not even use static strings in our projects, but it’s good to know it exists and how it works. In case you want to see a useful example of where you would use it, check out this article
We might all know how to add a target selector to a button, but have you ever set the target to nil? Dominik Hauser explains why this can be useful by making use of the responder chain.
I’ve written several command-line tools like Poes and GitBuddy, for which this article by Tibor Bödecs would’ve been a great help. Check it out if you’re interested in writing command-line apps in Swift.
This article by Kamil Tustanowski covers several tips for using the console during a debug session in Xcode. Covering thread interaction and printing objects, helping you to improve your debugging skills.
Even though this article only contains the “Swift” word once, it’s still worth a read. Seph shares his learnings from making CRDTs fast.

SWIFTLEE JOBS

Stream, a high-growth startup focused on Chat and Feeds, is hiring a Senior iOS SDK Architect to help build the future of their native iOS SDK. Join the team in...
SoundCloud is the world’s leading audio platform, allowing everyone to share and discover unique content anywhere, anytime, on mobile and on the web. We are now looking for a technical...
Is your company hiring too? Post your job position for free at SwiftLee Jobs and reach thousands of developers.

THANK YOU

Thanks for being a SwiftLee subscriber! 
Continue your journey: