Give your simulator superpowers

RocketSim: An Essential Developer Tool
as recommended by Apple

Using @Environment in SwiftUI to link Swift Package dependencies

The @Environment property wrapper in SwiftUI allows you to read values from a view's environment. You're able to configure an environment value yourself or make use of the default available values. Please read my article on Property Wrappers before diving into this one. Note that this is a different wrapper ...
SwiftUI

Identifiable protocol in SwiftUI explained with code examples

The Identifiable protocol in SwiftUI allows you to add a unique object identity. The protocol requires a single ID property of any hashable type, making it a flexible protocol for all kinds of instances. While it's a relatively simple protocol, a few possible edge cases can cause unexpected bugs in ...
SwiftUI

Key press events detection in SwiftUI

Key press events detection in SwiftUI allows you to respond to a keyboard key like return (enter), shift, command, and more. While mostly Mac apps use keyboard events, you must consider adding support for iPad apps since external keyboards can be used. SwiftUI offers several modifiers to listen to key ...
SwiftUI

How to use @ScaledMetric in SwiftUI for Dynamic Type support

The @ScaledMetric property wrapper in SwiftUI allows you to adopt custom values to dynamic type settings. Your custom values will scale proportionally whenever the user changes the dynamic type setting. While elements like text scale are automatically based on the Dynamic Type setting, other values like padding or image sizes ...
SwiftUI

ScrollView Bounce Behavior configuration in SwiftUI

A ScrollView bounce behavior configuration allows you to define whether a scrollable view bounces when reaching the end of its content. Whether it's a horizontal or vertical scrolling list, you can configure both directions using view modifiers in SwiftUI. There are common scenarios for us to build when it comes ...
SwiftUI

@Observable Macro performance increase over ObservableObject

The @Observable Macro was first introduced during WWDC 2023 to replace ObservableObject and its @Published parameters. The macro allows you to remove all published properties while still being able to redraw SwiftUI views when a change occurs automatically. I highly recommend replacing your ObservableObject instances since the new macro prevents ...
SwiftUI

SFSafariViewController in SwiftUI: Open webpages in-app

SFSafariViewController can be used to let your users open webpages in-app instead of in an external browser. While the view controller works great for UIKit, getting it to work in a SwiftUI app might be challenging. Whenever you're running into cases where a UIKit solution is available only, you want ...
SwiftUI

Debugging SwiftUI views: what caused that change?

Debugging SwiftUI views is an essential skill when writing dynamic views with several redrawing triggers. Property wrappers like @State and @ObservedObject will redraw your view based on a changed value. This is often expected behavior, and things look like they should. However, in so-called Massive SwiftUI Views (MSV), there could ...
DebuggingSwiftUI

App Intents Spotlight integration using Shortcuts

App Intents have been new since iOS 16 and offer a programmatic way to service your app's content and functionality to Siri and the Shortcuts app. New in iOS 17 is the option to surface App Shortcuts integrated into Spotlight, making your app's functionality even more discoverable. App Intents are ...
SwiftUI

ContentUnavailableView: Handling Empty States in SwiftUI

ContentUnavailableView is a SwiftUI view introduced in iOS 17 during WWDC 2023. It allows you to handle cases of networking failure or empty search results. It's essential to explain an empty state and its cause to your users. While you can generate custom empty states, reusing standard SwiftUI components is ...
SwiftUI

Universal Links implementation on iOS

Universal Links allow you to link to content inside your app when a user opens a particular URL. Webpages will open in the app browser by default, but you can configure specific paths to open in your app if the user has it installed. Redirecting users into your app is ...
SwiftUI
Loading...