Learn Swift and iOS Development
Master iOS development through in-depth tutorials and comprehensive courses on Swift, SwiftUI, UIKit, Core Data, and more.
Master iOS development through in-depth tutorials and comprehensive courses on Swift, SwiftUI, UIKit, Core Data, and more.
4:39
In the previous episodes of this series, we explored AnyObject and Any. Another keyword you encounter frequently in Swift is Void. What is Void? That is the focus of this installment of What The Swift.
5:56
Earlier this week, we discovered that AnyObject is a protocol defined in the Swift standard library. In today's installment of "What The Swift", I want to show you what Any is. To discover the meaning of Any, we need to revisit the Swift standard library.
6:10
If you've spent some time writing Swift, then you've probably come across a variable, constant, or parameter of type AnyObject. And you know what AnyObject is. Right? Don't worry. You're not alone. Let's take a look and dive into the bowels of the Swift standard library to find out.
The data your application receives from a remote API may be base64 encoded. It is the task of your application to base64 decode it. In this episode, I show you how easy that is using Swift.
Generating a unique identifier is easy thanks to Foundation's UUID struct. In this episode of Swift Fundamentals, you learn how to create an identifier that is (almost) guaranteed to be unique.
Generating random numbers in Swift is easy and requires only a single line of code. There are a few approaches, though. In this episode of Swift Fundamentals, we look at two options to generate a random number using Swift.
Most developers default to a for loop when they must loop through a collection or perform an operation several times. I find that the value of the while loop is often overlooked. It has some advantages over Swift's for loop in some scenarios. In this episode of Swift Fundamentals, you learn how to use a while loop in Swift and, more important, when it is appropriate to use a while loop over a for loop. Let's get started.
Looping over a collection is a common task in most programming languages. In this post, you learn about Swift's for loop and you learn that a for loop isn't always the best solution to the problem. Swift has several other constructs that are at times a better fit. Let's start with the for loop.
Time zones are convenient, but they are usually a pain for developers. Numerous bugs have made it into production because of time zones. The good news is that Apple's Foundation framework makes working with time zones pretty simple. In this episode, we take a look at Foundation's TimeZone struct and how to use it in a project. Fire up Xcode and create a playground if you want to follow along with me.
Mapping a dictionary to an array isn't difficult. You have a few options, the map(_:) method being my personal favorite for most situations. Converting an array to a dictionary is less trivial. Swift's Standard Library doesn't seem to offer an API to make this straightforward. In this episode, I show you two solutions.
Can you guess what happens if you execute this code snippet in a playground? The playground crashes due to an index out of bounds exception. This is a problem I have run into more times than I care to admit.
In Swift, a dictionary is nothing more than a collection of key-value pairs. In this post, I show you how to check if a dictionary contains a given key. Fire up Xcode and create a playground if you want to follow along with me.
Swift's Array type is powerful and flexible. In this post, I show you a simple solution to find an object in an array. Fire up Xcode and create a playground if you want to follow along. Clear the contents of the playground and add an import statement for Foundation.