Replacing UIScreen.main Before iPhone Duo Arrives
UIScreen.main assumes your app lives on one screen with one size. iPhone Duo, iPhone Mirroring, and iPad windowing all break that assumption. Here's what to use instead in UIKit and SwiftUI.
// 17 articles available
UIScreen.main assumes your app lives on one screen with one size. iPhone Duo, iPhone Mirroring, and iPad windowing all break that assumption. Here's what to use instead in UIKit and SwiftUI.
Apps built with the iOS 27 SDK must use the UIKit scene life cycle or they fail to launch. Here's how to tell if your app is affected, add a scene manifest, and move your app delegate code into a scene delegate.
iOS 27.2 adds a titleAlignment property to UINavigationItem, so you can pin an inline navigation title to the leading edge or keep it centered. Here's how it works, plus the trait that tells custom title views which alignment the bar picked.
iOS 27.1 lets you read iPhone Duo's hinge angle and fold status with onHingeChange in SwiftUI and UIHingeInteraction in UIKit. Here's how the APIs work, why they're for interactive effects rather than layout, and a fold-to-scrub example.
iPhone Duo ships on October 23 with a folding inner display, a compact outer display, and toolbars that move to the side. Here's what to check in your app first, and where the new iOS 27.1 APIs fit in.
Understand the key difference between a UIView's frame and bounds properties, and when to use each in your iOS apps.
A practical guide to choosing between SwiftUI and UIKit in 2026, based on your project requirements, team experience, and the current state of both frameworks.
Learn how to detect when users shake their device in SwiftUI by bridging to UIKit's motion events and creating a reusable view modifier.
How to traverse the view controller hierarchy to find the currently visible view controller.
Access an existing app delegate with UIApplication.shared.delegate as? AppDelegate, or with the @UIApplicationDelegateAdaptor property in SwiftUI.
Learn how to access photos from the camera roll in SwiftUI, including required permissions, Info.plist configuration, and using PhotosPicker for iOS 16+ or UIImagePickerController for earlier versions.
Learn how to detect when a user successfully shares content using a share sheet in SwiftUI by wrapping UIActivityViewController.
Detect screenshots with a UIKit notification and keep sensitive SwiftUI content out of them. Tested on iOS 27, including the popular trick that doesn't work.
Learn how to add pull-to-refresh functionality to custom ScrollViews in SwiftUI without using List, perfect for custom layouts and complex scroll content.
Add an AppDelegate to a SwiftUI app with @UIApplicationDelegateAdaptor to handle push tokens, launch options, and lifecycle callbacks SwiftUI lacks.
Learn how to create a WebView/WKWebView with a transparent/clear background in SwiftUI.
Learn how to use a WKWebView as a quick way to load a GIF from a URL and display it in a SwiftUI view.