Give your simulator superpowers

RocketSim: An Essential Developer Tool
as recommended by Apple

Win a copy of The macOS App Icon Book with thisfree giveaway

URLSessionConfiguration: Exploring opt-in configurations

URLSessionConfiguration can be used to initialize URLSession instances in Swift. While in most cases, you'll likely use the default configuration, you'll also have the opportunity to create a custom configuration with non-default settings. The default URLSessionConfiguration uses standard configurations that work best for most apps. However, no configuration fits all, ...

App Store Connect API SDK in Swift: Creating Developer Tools

The new App Store Connect API was announced during WWDC 2018 and made it possible to write applications for App Store Connect. You can use the API to fetch metadata for apps, TestFlight builds, download sales reports, and much more. Apple added new endpoints over the years, with most recently ...

Generics in Swift explained with code examples

Generics in Swift allows you to write generic and reusable code, avoiding duplication. A generic type or function creates constraints for the current scope, requiring input values to conform to these requirements. You've probably been using generic implementations already since they're all over the place in the Swift standard library ...

Existential any in Swift explained with code examples

Existential any allows you to define existential types in Swift by prefixing a type with the any keyword. In short, an existential means "any type, but conforming to protocol X." Any and AnyView have different purposes, which I explain in my article AnyObject, Any, and any: When to use which? ...

Some keyword in Swift: Opaque types explained with code examples

The some keyword in Swift declares opaque types, and Swift 5.1 introduced it with support for opaque result types. Many engineers experience working with opaque types for the first time when writing a body of a SwiftUI view. Though, it's often unclear what some keyword does and when to use ...

Increase App Ratings by using SKStoreReviewController

SKStoreReviewController allows asking your users for App Store ratings from within the app. Positive ratings can help your app stand out in the App Store and attract more users. Conversions can increase when you ask the user for a rating at the right time. While implementing rating requests is easy, ...

Memory leaks prevention using an autoreleasepool in unit tests

Memory leaks often happen without notice. Although best practices like using a weak reference to self inside closures help a lot, it's usually not enough to prevent you from finding a certain memory peak during the development of a project. We can use memory graph debugging or Xcode Instruments to ...

AsyncSequence explained with Code Examples

AsyncSequence is part of the concurrency framework and the SE-298 proposal. Its name implies it's a type providing asynchronous, sequential, and iterated access to its elements. In other words: it's an asynchronous variant of the regular sequence we're familiar with in Swift. Like you won't often create your custom Sequence ...

AsyncThrowingStream and AsyncStream explained with code examples

AsyncThrowingStream and AsyncStream are part of the concurrency framework introduced in Swift 5.5 due to SE-314. Async streams allow you to replace existing code that is based on closures or Combine publishers. Before diving into details around throwing streams, I recommend reading my article covering async-await if you didn't do ...

Using MetricKit to monitor user data like launch times

The MetricKit framework allows us to collect all kinds of data from our end users, including launch times and hang rates. MetricKit data can be explored by going into the Xcode organizer panel in which several metrics are listed. Several techniques exist to improve launch times, but it all starts ...

AnyObject, Any, and any: When to use which?

AnyObject and Any got a new option any as introduced in SE-355, making it harder for us developers to know the differences. Each option has its use cases and pitfalls regarding when not to use them. Any and AnyObject are special types in Swift, used for type erasure, and don't ...

How to use the #available attribute in Swift

Marking pieces of code as available or unavailable per platform or version is required in the ever-changing landscape of app development. When a new Swift version or platform version arrives, we'd like to adapt to it as soon as possible. Without throwing away support for older versions we can make ...