Swift
Learn more and get better in Swift using this list of Swift blog posts, tutorials, tips, and tricks.
SF Symbol: How to for Swift & SwiftUI
Apple introduced SF Symbols during WWDC 2019 as a big present for developers, as they're straightforward and free to use. Apple introduced several updates over the years, resulting in a library of over 6000+ symbols. All symbols are designed to integrate seamlessly with San Francisco, the system font for Apple ...
Enum explained in-depth with code examples in Swift
Enum usage in Swift: If case, guard case, fallthrough, associated values, and the CaseIteratable protocol. These terms could sound familiar if you've worked extensively with Swift enums. An enumeration defines a common type for a group of related values and enables you to work with those values in a type-safe way within your ...
MainActor usage in Swift explained to dispatch to the main thread
MainActor is a new attribute introduced in Swift 5.5 as a global actor providing an executor that performs its tasks on the main thread. When building apps, it's essential to perform UI updating tasks on the main thread, which can sometimes be challenging when using several background threads. Using the ...
Codemagic makes Apple M2 machines available, even on the free tier!Codemagic is the first CI/CD to make Apple M2 machines available to everyone (including the free tier!). This is a free upgrade from M1 machines with no price change. Get started today.
Security-scoped bookmarks for URL access
Security-scoped bookmarks allow you to store access to a given user-selected URL. They are commonly used on macOS to store access information for a user-selected directory. Restoring the security-scoped bookmark data allows you to regain access to a folder previously selected by the user. I've been using this technique for ...
JSON Parsing in Swift explained with code examples
JSON parsing in Swift is a common thing to do. Almost every app decodes JSON to show data in a visualized way. Parsing JSON is definitely one of the basics you should learn as an iOS developer. Decoding JSON in Swift is quite easy and does not require any external ...
Typed throws in Swift explained with code examples
Typed throws are new since Xcode 16 and allow you to define the type of error a method throws. Instead of handling any error, you can handle exact cases and benefit from compiling time checks for newly added instances. They were introduced and designed in Swift Evolution proposal SE-413. I ...
Async await in Swift explained with code examples
Async await is part of the new structured concurrency changes that arrived in Swift 5.5 during WWDC 2021. Concurrency in Swift means allowing multiple pieces of code to run at the same time. This is a very simplified description, but it should give you an idea already how important concurrency ...
Swift Package Manager framework creation in Xcode
Swift Package Manager (SPM) is Apple's answer for managing dependencies. We're all familiar with tools like CocoaPods and Carthage, but we'll likely all use Swift Package Manager soon instead of those. If you're deciding which package manager to use, it's recommended to start using SPM today. By switching to the ...
ChatGPT for Swift: Top 5 code generation prompts
Using ChatGPT for Swift code generation can drastically increase your productivity. While I'm uncertain whether AI will take over our jobs as developers, I'm certain developers without knowledge of using AI to their advantage will become much slower in writing code. Today, we will look at a few of my ...
Repository design pattern in Swift explained using code examples
The repository design pattern allows you to create an accessible data layer that's easy to mock for tests. By using common design patterns, you'll be able to create a consistent project structure, separate concerns, and increase the chances for the project to be easier to understand by outside contributors. One ...
Optionals in Swift explained: 5 things you should know
Optionals are in the core of Swift and have existed since the first version of Swift. An optional value allows us to write clean code while at the same time taking care of possible nil values. If you're new to Swift, you should get used to the syntax of adding ...