Once-a-year Black Friday deals are coming. Read more.
Give your simulator superpowers

RocketSim: An Essential Developer Tool
as recommended by Apple

@Entry macro: Creating custom environment values in SwiftUI

The @Entry macro in SwiftUI allows you to define custom environment values without writing boilerplate code. While introduced in Xcode 16, you can use it from iOS 13 and up since it's a Swift Macro that generates backward-compatible code. The new macro can be used for environment values, as well ...
SwiftUI

Memory consumption when loading UIImage from disk

Memory consumption can quickly increase if you load many images from the disk using UIImage. You'll generally load images from a remote address or via an asset catalog. However, you have bundled images in some cases, and you need to load them directly from a bundle path. In those cases, ...
DebuggingSwiftUI

Why macOS Development is Perfect for Indie Developers

Building apps for macOS offers developers a fantastic opportunity to expand their skills, create useful utilities to solve their problems, and begin their journey as indie developers. I've invited Jordi Bruin to write a guest article on this topic as he launched several useful Mac applications, such as MacWhisper and ...
SwiftUI

@Previewable: Dynamic SwiftUI Previews Made Easy

Xcode 16 introduced the @Previewable macro for SwiftUI Previews, allowing you to use dynamic properties inline in previews. You'll be able to make richer and more dynamic previews of your SwiftUI views without the need to wrap any state inside child views. Swift and SwiftUI use macros to hide implementation ...
SwiftUI

MVVM: An architectural coding pattern to structure SwiftUI Views

MVVM (Model-View-ViewModel) is an architectural coding pattern for structuring SwiftUI views. The goal of the pattern is to separate the view definition from the business logic behind it. Your views will not depend on any specific model type if done correctly. While MVVM was mostly used in the UIKit/AppKit days, ...
SwiftUI

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
Loading...