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

Fix: ‘imageWithData’ is unavailable in Swift
Swift blocks imageWithData: because of the initializer rule. Load images from a URL the right way with URLSession, async/await, and caching.
-

Fix: Critical Alert Sounds Only Play One at a Time in iOS
Why two critical alert notification sounds never overlap in iOS, and how to get simultaneous alarm audio with AVAudioPlayer or a single…
-

Fix: AVAudioPlayer.stop() Does Nothing Because the Players Array Is Empty in SwiftUI
Why your SwiftUI game keeps playing sounds after calling stop(): the players array is empty because a second AVAudioPlayer is created outside…
-

How to Convert Int to String and Vice Versa in Swift
Learn the definitive ways to convert Int to String and String to Int in Swift. Master initializers and type casting for robust…
-

Fix: SwiftUI Popover Text Truncated Instead of Wrapping
Stop SwiftUI popovers truncating long text. Use a custom Layout to size the popover to its content, with a max width, no…
-

Fix: UILabel Text Vertically Centered Instead of Top-Aligned in UIKit
UILabel has no vertical alignment property. Learn how to top-align text with sizeToFit, Auto Layout timing, and modern alternatives that actually work.
-

Fix: CBCentralManager State 2 (Unsupported) and No Bluetooth Permission Prompt on iOS 18
Learn why your iOS app never asks for Bluetooth permission and CBCentralManager reports state 2, and how to fix the Info.plist key…
-

How to Split a String into an Array in Swift
Learn the modern and efficient ways to split a String into an array of substrings in Swift using split() and components(separatedBy:).
-

Fix: SwiftUI Form Section Buttons Not Horizontally Centered
Why buttons and text in a SwiftUI Form Section hug the leading edge, and the frame and Spacer tricks that actually center…
