Swift & SwiftUI
Swift and SwiftUI explained with working code examples: concurrency, data flow, layout and common compiler errors.
-

How to Round a Double to X Decimal Places in Swift
Round a Swift Double to any number of decimal places with a small extension, and learn when to use String(format:), NumberFormatter or…
-
![Fix: Array Extension Requires '[T]' and '[any TextContainer]' Match Fix: Array Extension Requires ‘[T]’ and ‘[any TextContainer]’ Match](https://apple-developers-inc.com/wp-content/uploads/2026/10/fix-array-extension-requires-t-and-any-textcontainer-match.jpg)
Fix: Array Extension Requires ‘[T]’ and ‘[any TextContainer]’ Match
Why a generic T: TextContainer won’t satisfy an Array extension written for [any TextContainer], and how to rewrite the extension so both…
-

Fix: Instance member ‘someVar’ cannot be used on type ‘InnerView’
SwiftUI nested structs can’t read the parent view’s properties. Use computed properties, parameter passing, @Binding or @Observable to share state cleanly.
-

How to Do Sample-Accurate AVPlayer Audio Scrubbing in Reverse
AVPlayer can’t render sample-accurate or reversed audio while scrubbing. Here’s why, and how to drive PCM playback through AVAudioEngine yourself.
-

Fix: Unexpectedly found nil while unwrapping an Optional value
Why Swift crashes with ‘Unexpectedly found nil while unwrapping an Optional value’, how to find the line, and fix it with if…
-

Fix: SwiftData ModelContainer Hides Core Data Migration Error on iOS 26
Learn why SwiftData’s ModelContainer hides Core Data migration errors on iOS 26 and earlier, and how to extract the real NSError using…
-

Swift Date: Get the Current Hour and Minute Without a Formatter
Date has no .hour property in Swift. Use Calendar to read the current hour, minute and second, and know when a DateFormatter…
-

Fix: SwiftUI Removal Transition View Disappears Before It Collapses
A SwiftUI asymmetric removal transition drops the live view before the collapse finishes. Here’s why the empty HStack helps and how to…

