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

Fix: PDFView Selected Text Centers at Top Instead of Screen Center in SwiftUI
Learn why PDFView scrolls selected text to the top and how to center it properly using the underlying UIScrollView in SwiftUI.
-

Swift String Contains: Check for a Substring (Case-Insensitive Too)
Use String.contains for a literal substring check in Swift, and range(of:options:) when you need case- or diacritic-insensitive matching in your app.
-

How to Add an About Box to a SwiftUI iOS App
Add an About box to a SwiftUI iOS or iPadOS app: a fitted sheet with a zoom transition, one shared AboutView, and…
-

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…
