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

Fix: Tab Bar Missing After Applying .tabViewStyle(.page)
Learn why applying .tabViewStyle(.page) hides your SwiftUI tab bar and how to implement swipeable paging while keeping navigation tabs visible.
-

Fix: `Timer` Call Produces a Type Error in Swift
Learn why a Swift Timer call fails, how to schedule repeating or one-shot timers, stop them safely, and avoid selector and retain-cycle…
-

Fix: Text Alignment in SwiftUI
Learn how to align SwiftUI text left, center, or right, and when to use multilineTextAlignment versus frame alignment for the layout you…
-

Fix: String-to-Double Conversion Fails in Swift
Learn how to convert a Swift String to Double safely, reject invalid input, and parse decimal or currency text using the right…
-

Fix: UITextField Text Change Event Reads Old Text in Swift
Use UIKit’s .editingChanged event to read the updated UITextField value, recalculate dependent fields, and avoid stale text in shouldChangeCharactersInRange.
-

Fix: `UITapGestureRecognizer` Won’t Fire Programmatically
Stop calling nonexistent UIView event APIs: attach a UITapGestureRecognizer correctly, invoke shared tap logic in unit tests, or tap the view in…
-

Fix: Convert an ISO 8601 String to `Date` in Swift
Parse an ISO 8601 timestamp like `2016-04-14T10:44:00+0000` into Swift `Date`, handle its UTC offset, and safely extract the year, month, day, and…
-

Fix: UITextView Does Not Grow to Fit Its Text in UIKit
Learn how to make a UIKit UITextView grow with its text using sizeThatFits and a height constraint, including setup, editing updates, and…
-

Fix: `addObserver` Not Receiving Notifications in Swift
Learn how to add a NotificationCenter observer in Swift, fix selector and notification-name mistakes, and remove observers safely when they are no…
-

How to Log in Swift: print, NSLog, and Logger
Compare Swift print, NSLog, and Logger, learn what happened to println, and choose the right option for debugging or viewing device logs.