In my previous articles on structured concurrency with Swift, I walked through some practical examples of how I envision developers using the async/await syntax to streamline and simplify asynchronous code. This article extends the basics of async / await with an existing standard — exception handling.
While I fully support the idea that syntax comes secondary to solution design, there are times when understanding syntax goes a long way to mastering the process. In Swift, language features like optionals and closures come to mind in addition to exception handling. …
Original article published here.
In my previous article on structured concurrency with Swift, I highlighted many new asynchronous programming concepts anticipated with Swift 5.5. New keywords like Actors, MainActor, Async, and Await, will quickly be used in regular Swift applications, helping streamline complex operations and increase efficiency.
What’s nice about the new model is that it provides a great platform to express one’s ideas clearly, depending on the data scenario. To illustrate, let’s review how one can use async/await commands to replicate sequential versus concurrent operations. To start, let’s write sample code for retrieving photos from an external service:
The introduction of Swift 5.5 comes a new model for managing asynchronous programming. Although many anticipated new hardware announcements at Apple’s WWDC21, instead, we received a redux in how many of us will write code for Swift-based apps, including iOS and beyond. As we will see, these changes focus on implementing more structured code when it comes to asynchronous operations.
When Swift was first introduced in 2014, a challenging language feature to grasp was optional variables. Not being able to assign nil to non-optional values or do other seemingly straightforward tasks proved confusing and nuanced:
var item = "first"
After helping many iOS developers prepare for technical interviews I’ve grown a fun list of questions I feel exercise a candidate’s breadth of knowledge when it comes to algorithms, data structures, and coding syntax. Feel free to cruise through the list as most of these are my favorites. What’s nice about programming is that there’s rarely a single right way of doing things. Rather it’s all about one proving their approach through thoughtful analysis, development experience as well as applying tools like Big-O Notation. Let’s begin!
Given an array of strings made only from lowercase letters, return a list of…
For iOS developers at any level, learning something new can be a time-consuming and challenging process. When discussing career goals with other iOS developers, most possess a good understanding of Swift/iOS coding syntax and commonly used design patterns. However, roadblocks are met when understanding ideas behind computer science, problem solving and algorithms. If this describes you, here are 5 free resources to help you ace your next technical interview.
The iOS Interview Worksheet
Initially conceived as handwritten notes as I prepared for a technical interview at Google (years ago), this free resource has been expanded to support the many areas of…
As a software engineer, I’ve had the opportunity to see many software and hardware technologies introduced over the years. Beyond writing code, I also work as an educator, teaching computer science essentials to other iOS developers. Back when I started, the Java programming language was just released, and the possibilities of the internet were being realized with the launch of Mosaic and Netscape. It was the golden age of the x86 platform, including countless PCs being sold with 386, 486, and Pentium processors.
Recently, a great developer enrolled in my weekly iOS Computer Science Lab approached me with a link on how to write a popular algorithm in Swift. Since we review similar concepts in class, I was intrigued and proceeded to check out the details. Even though the essay had received many views (likes), disappointment set in as I realized portions were lacking, were poorly communicated and technically incomplete. To support my assumptions, the author was unable to answer questions asked by audience members.
After helping iOS developers prepare for technical interviews, I like to reconnect with folks to discuss tough questions that they were asked. Recently, I came across an interesting challenge that involved binary notation and thought it worthy of a review. Even though it’s rare for hiring managers to ask candidates questions on this topic, this one has less to do with the notation and more to do with data management. For example:
When helping iOS developers prepare for technical interviews I like to put a focus on popular “gotchas” most likely to be asked by hiring managers. Beyond essential data structures and algorithms, a good way to test one’s competency is to present challenges that showcase Swift’s unique features. In addition to the use of optionals and generics, what makes Swift a robust language is its extensive use of protocols. In this essay, we’ll walk through an example of protocol-oriented programming.
Boats, Planes & Seaplanes
To succeed in a technical interview, one must be proficient enough with one’s language of choice to express…
For new or even experience developers we often hear one of the keys advancing in one’s career is becoming more familiar with algorithms. Sometimes we’ll even hear the term “algorithmic thinking”. As the name implies, this way of approaching problems isn’t a one-size-fits-all solution but does contain some common elements. Consider this question from Quora:
Q: I’ve heard a lot about algorithms, I’m a beginner, how do programmers learn to think and solve problems algorithmically? Is there a process for this kind of thinking?
No technical interview would be complete without a basic test on String manipulation. While there are…