Construct and manage graphical, event-driven user interfaces for iOS or tvOS apps using UIKit.

UIKit Documentation

Posts under UIKit subtopic

Post

Replies

Boosts

Views

Activity

4 or 5 Finger Gestures on iPadOS 26
I disable 4 or 5 Finger Gestures on Settings.app > Multi-tasking and Gestures. But in the third-party apps, 4-5 finger touches are sometimes immediately cancelled. Especially, 4-5 finger swipe gesture. I filed this issue to FB19226717. I develop Piano instrument app. 4 or 5 finger touches are required for that kind of apps. Please fix this, Apple.
0
0
79
Jul ’25
A bug in iOS 26 on UISegmentedControl
On iOS 26 beta 4 segmented control is not working properly when created via xib. When selecting, text is disappearing . Here is the link where it shows bug with a video. https://www.reddit.com/r/Xcode/comments/1m9n9qi/xcode_and_os_26_beta_4_liquid_glass_ui_still_has/?utm_source=share&utm_medium=web3x&utm_name=web3xcss&utm_term=1&utm_content=share_button
Topic: UI Frameworks SubTopic: UIKit
2
0
103
Jul ’25
iOS 26 web page with script is terminated on custom scheme WKURLSchemeHandler
Something has changed in iOS 26 and now if custom scheme is used and web page contains scripts WebKit is terminated. 0x1130bc170 - [PID=47858] WebProcessProxy::didClose: (web process 0 crash) 0x1130bc170 - [PID=47858] WebProcessProxy::processDidTerminateOrFailedToLaunch: reason=Crash final class CustomSchemeViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() let sampleConfiguration = WKWebViewConfiguration() sampleConfiguration.setURLSchemeHandler( SampleURLSchemeHandler(), forURLScheme: "sample" ) let webView = WKWebView(frame: view.bounds, configuration: sampleConfiguration) webView.autoresizingMask = [.flexibleWidth, .flexibleHeight] view.addSubview(webView) webView.navigationDelegate = self webView.load(URLRequest(url: URL(string: "sample://pages/sample.html")!)) } } extension CustomSchemeViewController: WKNavigationDelegate { func webViewWebContentProcessDidTerminate(_ webView: WKWebView) { print("webViewWebContentProcessDidTerminate") } } final class SampleURLSchemeHandler: NSObject, WKURLSchemeHandler { private func post(_ body: String, mimeType: String, urlSchemeTask: WKURLSchemeTask) { let body = Data(body.utf8) let response = URLResponse( url: urlSchemeTask.request.url!, mimeType: mimeType, expectedContentLength: body.count, textEncodingName: nil ) urlSchemeTask.didReceive(response) urlSchemeTask.didReceive(body) urlSchemeTask.didFinish() } func webView(_ webView: WKWebView, start urlSchemeTask: WKURLSchemeTask) { switch urlSchemeTask.request.url?.lastPathComponent { case "sample.html": post(""" <?xml version="1.0" encoding="UTF-8"?><html xmlns="http://www.w3.org/1999/xhtml"> <head> <script src="/scripts/sample.js"></script> </head> <body> <p>Sample</p> </body> </html> """, mimeType: "application/xhtml+xml", urlSchemeTask: urlSchemeTask ) case "sample.js": post("console.log('Hello from JS File')", mimeType: "text/javascript", urlSchemeTask: urlSchemeTask ) default: assertionFailure() } } func webView(_ webView: WKWebView, stop urlSchemeTask: WKURLSchemeTask) { print("webView(_ webView: WKWebView, stop urlSchemeTask: WKURLSchemeTask)") } } It works fine with css file inside, without script tag or with async attribute Code of sample project https://github.com/Igor-Palaguta/iOS26URLSchemeTermination
2
2
158
Jul ’25
Optimizing for the 500 widgets and updating it faster in iOS
I am creating 500 textfield widgets and then updating them and all their 40 properties at once. I require to update all 500 widgets with their properties at once as it is a usecase in our app, so pooling and showing only those that will be on screen won't really help in this case. I have found that for updating all these 500 textfield widgets with their 40 properties, the time taken is 80 to 100 milliseconds. However, if I update the non-string properties like .text, then it comes down to half which is 40 to 50 milliseconds. Wanted to know if there was a far more quicker or optimized way to do this? The following snippet of code shows what I am doing: @objc private func handleImmediateMode() { let startTime = CFAbsoluteTimeGetCurrent() for (index, textField) in retainedInputFields.enumerated() { updateAllProperties(for: textField, index: index) } let endTime = CFAbsoluteTimeGetCurrent() print("Immediate Mode -- (500 fields, 40 props): \( (endTime - startTime) * 1000) ms") } In the above code, I have already created the 500 textfield widget, and then in updateAllProperties () function I am passing the textfield widget to it and then updating the 40 properties that the widget has. Particularily, the following properties: textField.placeholder = "Input Field (index)" UILabel().text Seem to be adding the extra 40 - 50 milliseconds.
0
0
24
Jul ’25
Label text in UISplitViewController primary column not respecting dark mode in iOS 26 beta 4
In iOS 26 beta 4 (build from July 2025), there is a visual issue when using a UISplitViewController. Specifically, the text color of labels in the primary column does not adapt correctly to Dark Mode. This includes navigation bar titles and labels inside UITableViewCells. Regardless of system appearance settings, the text remains black, making it unreadable when the system switches to Dark Mode. To reproduce this, create a new iOS project using UISplitViewController with the .doubleColumn style. In the primary column, embed a UIViewController that contains a navigation title using navigationItem.title, and a UITableView showing a list of items. Run the app on a device or simulator with iOS 26 beta 4. Then switch the system appearance to Dark Mode using Control Center and observe the interface. The expected result is that all labels in the primary column, including the navigation title and table view cell labels, should automatically update to a light text color in Dark Mode. This behavior works correctly in iOS 18. However, the actual result is that all these labels remain black, leading to poor visibility in Dark Mode and ignoring the system’s appearance setting. https://feedbackassistant.apple.com/feedback/19194379
Topic: UI Frameworks SubTopic: UIKit Tags:
1
1
46
Jul ’25
iOS 18 Zoom Transition: Glitchy source view animation when user swipes the Collection View as dismiss animation is finishing
The iOS 18 Zoom Transition animation is glitchy when the source view is a UICollectionViewCell and just after dismissing the Detail View, user swipes their finger on the the UICollectionView. The cell's animation appears glitchy as it's settling into its final position. Steps to Reproduce: Create a UICollectionView with a UICollectionViewCell as a source view for the Zoom Transition Implement iOS 18 Zoom Transition using preferredTransition = .zoom { context in return cell } Present a detail view by tapping a UICollectionViewCell (zoom in works correctly) Dismiss the detail view by performing a swift/quick swipe gesture up or down in one fluid motion Important to note: This issue does not reproduce if you slowly scroll the scroll view by holding your finger down on it. It only reproduces if you swipe and lift your finger up. I've attached the video showcasing the issue: https://github.com/davor-storyteller/ios-18-zoom-transition-sample/issues/1 Expected Behavior: The detail view should smoothly zoom back into the original collection view cell position with a fluid animation, regardless of swipe gesture. Actual Behavior: When using swift swipe gestures, the zoom transition back to the collection view cell appears glitchy - the cell animation may appear jerky, incorrectly positioned, or have visual artifacts during the transition. Here is a link to the Github repository with sample code where this issue is reproducible: https://github.com/davor-storyteller/ios-18-zoom-transition-sample
Topic: UI Frameworks SubTopic: UIKit
1
1
77
Jul ’25
Unable to Tint Custom View in UIBarButtonItem on iOS 26
When using a custom UIButton as the customView for a UIBarButtonItem in iOS 26, setting the tintColor on the UIBarButtonItem or the button itself does not affect the button’s appearance in the navigation bar. The button displays, but the tint is not applied as expected. Steps to Reproduce: Create a new iOS project with a navigation controller. Use the following code in your view controller: class ViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() view.backgroundColor = .secondarySystemBackground var configuration = UIButton.Configuration.plain() configuration.title = "Why Not Tinted...?" configuration.baseForegroundColor = .systemBlue configuration.contentInsets = NSDirectionalEdgeInsets(top: 12, leading: 12, bottom: 12, trailing: 12) let button = UIButton(configuration: configuration) let rightBarButton = UIBarButtonItem(customView: button) rightBarButton.tintColor = .green navigationItem.rightBarButtonItem = rightBarButton } } Expected Result: The UIButton in the navigation bar should appear green with glass effect, according to the tintColor set on the UIBarButtonItem. Actual Result: The UIButton appears, but the tintColor is not applied. Changing the tintColor on either the UIBarButtonItem or the UIButton has no effect on its appearance in the navigation bar.
Topic: UI Frameworks SubTopic: UIKit Tags:
2
0
101
Jul ’25
Xcode 26 beta iOS 16 crash Symbol not found: _UIMenuAutoFill
when launch my app from the Xcode 26 beta on iOS 16 I get this crash: Referenced from: <BB79205B-F03B-382A-A5D7-3F0C8A3135E5> /private/var/containers/Bundle/Application/7C842707-BB01-4C34-A2E0-318DC6E5B3D8/My APP.app/My APP.debug.dylib Expected in: <44798FBF-5AD6-37FB-A58C-DE1B58F2A2E7> /System/Library/Frameworks/UIKit.framework/UIKit Symbol not found: _UIMenuAutoFill Referenced from: <BB79205B-F03B-382A-A5D7-3F0C8A3135E5> /private/var/containers/Bundle/Application/7C842707-BB01-4C34-A2E0-318DC6E5B3D8/My APP.app/My APP.debug.dylib Expected in: <44798FBF-5AD6-37FB-A58C-DE1B58F2A2E7> /System/Library/Frameworks/UIKit.framework/UIKit dyld config: DYLD_LIBRARY_PATH=/usr/lib/system/introspection DYLD_INSERT_LIBRARIES=/usr/lib/libBacktraceRecording.dylib:/usr/lib/libMainThreadChecker.dylib:/usr/lib/libRPAC.dylib:/Developer/Library/PrivateFrameworks/DTDDISupport.framework/libViewDebuggerSupport.dylib
Topic: UI Frameworks SubTopic: UIKit Tags:
5
0
79
Jul ’25
UIAlertAction.isEnabled = false Has No Visual Effect on iOS 26 (Action Still Looks Enabled)
Hi all, I'm running into a UIKit issue specific to iOS 26 (Xcode 26 Beta 4) where UIAlertAction buttons that are disabled using .isEnabled = false do not appear visually disabled. The alert still shows the action with full opacity and default styling, making it look like the button is tappable — even though it isn't. ❗ Issue: On iOS 26, disabled actions in UIAlertController no longer appear dimmed or inactive. This is a visual regression compared to iOS 18 and earlier, where disabled actions would automatically appear grayed out and visually distinct.
Topic: UI Frameworks SubTopic: UIKit Tags:
2
0
100
Jul ’25
UIAlertAction.isEnabled = false Has No Visual Effect on iOS 26 (Action Still Looks Enabled)
Hi all, I'm running into a UIKit issue specific to iOS 26 (Xcode 26 Beta 4) where UIAlertAction buttons that are disabled using .isEnabled = false do not appear visually disabled. The alert still shows the action with full opacity and default styling, making it look like the button is tappable — even though it isn't. ❗ Issue: On iOS 26, disabled actions in UIAlertController no longer appear dimmed or inactive. This is a visual regression compared to iOS 17 and earlier, where disabled actions would automatically appear grayed out and visually distinct.
Topic: UI Frameworks SubTopic: UIKit
1
0
41
Jul ’25
RealityKit battery drain intuition?
Hi all, Is there a standard, good intuition about RealityKit battery drain vs how the Xcode profiler tends to display things? I have a realitykit ARview that i have permanently in my view hierarchy and the profiler is saying constantly 40% CPU spin, ~160mb increase of memory usage compared to when not using this view, and battery increased from Low to middle of the yellow bar for "high". Yet the actual battery drain attributed to my app is basically an order of magnitude lower than the battery drain of something like Tiktok for the same amount of foreground time (15% vs 2%) So I'm a little confused whether or not to trust the Xcode battery profiler when working with RealityKit and ARViews (unless Tiktok is in very high usage all the time!). Is this a largely ignorable signal, and more generally, how useful is this profiler? Doesn't seem immediately intuitive to me at first use. Thanks!
0
0
127
Jul ’25
App no longer runs in latest Xcode 26 Beta 4 17A5285i
Since installing the latest Xcode Beta (version 26.0 beta 4 17A5285i), it no longer runs my app on iPhone 11 and also not on iPad 10.2, both running iOS 18.5. The following code in - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions ... // Preload both Tabbar Views NSArray* tabViewControllers = _tabBarController.viewControllers; _firstViewCntrl = (FirstViewController *)[tabViewControllers objectAtIndex:0]; _secndViewCntrl = (SecondViewController *)[tabViewControllers objectAtIndex:1]; UIView *dummy1 __unused; UIView *dummy2 __unused; dummy2 = _secndViewCntrl.view; // Triggers viewDidLoad <<<<< CRASH will crash the app (the problem is with the 'view' attribute): *** Terminating app due to uncaught exception 'NSInvalidUnarchiveOperationException', reason: 'Could not instantiate class named TtGC5UIKit17UICoreHostingViewVCS_21ToolbarVisualProvider8RootView because no class named TtGC5UIKit17UICoreHostingViewVCS_21ToolbarVisualProvider8RootView was found; the class needs to be defined in source code or linked in from a library (ensure the class is part of the correct target)' When I instead choose the Simulator (iPhone 16 Rosetta) as a destination, the app runs fine and the above assignment will trigger the viewDidLoad method of the second ViewController. So the Rosetta simulator runs fine, but the physical device fails. The debugger console illustrates the differences between stable and beta Xcode versions (both on physical device): Xcode Version 16.4 (16F6) from AppStore (app runs fine): (lldb) p _secndViewCntrl.view (UIView *) 0x0000000108366d00 Xcode Beta version 26.0 beta 4 17A5285i (app now crashes): (lldb) p _secndViewCntrl.view error: Execution was interrupted, reason: internal ObjC exception breakpoint(-9).. The process has been returned to the state before expression evaluation. Any ideas?
Topic: UI Frameworks SubTopic: UIKit
4
0
266
Jul ’25
How to customize UIActivityViewController
We are currently developing an enterprise iOS application and are in the process of implementing Data Leakage Protection (DLP) features. As part of this effort, we need to control the available actions and target applications presented within the UIActivityViewController. Specifically, we would like to programmatically filter or restrict certain activities and destination apps shown in the share sheet based on user-specific permissions. These permissions will be dynamically evaluated and updated at runtime. This type of functionality is supported by the Microsoft Intune SDK. However, our objective is to implement this behavior natively within our application without relying on any third-party libraries. Could you please advise on the recommended approach or available APIs to achieve this level of control over the UIActivityViewController?
4
0
255
Jul ’25
For the property modifiers of XIB controls, should we use strong or weak?
In our current code, the properties of XIB controls are added with weak. However, we encounter some crashes due to accessing wild pointers of controls when a memory warning occurs. Colleagues from our architecture team said that they had specifically consulted Apple's technical staff before, and the reply was that strong should be used for modification, as it would make the memory more stable. They also mentioned that the statement in the official documentation is incorrect and hasn't been updated. May I ask whether strong or weak should be used for XIB control properties? What is your latest standard answer?
Topic: UI Frameworks SubTopic: UIKit Tags:
4
0
105
Jul ’25
Incorrect safeAreaInsets.top on iPhone SE (2nd/3rd gen) – iOS 26 Beta
On iPhone SE (2nd/3rd generation) running iOS 26 beta , the safeAreaInsets.top unexpectedly returns 0 instead of the expected 20 points, causing UI elements that rely on safe area layout to be overlapped by the status bar. You can see that i works fine with iOS 18, whereas iOS 26 the status bar is overlapped. Is this a known bug or there is new API changes that I might not be aware of.
Topic: UI Frameworks SubTopic: UIKit Tags:
3
0
336
Jul ’25
How to get UITextView to fit inside container, AND auto wrap
I am currently having an issue in where whenever I place a UITextView with text that's long, it simply pushes past the width of the container it is in, and when I do try and set a width, it does auto wrap and ignores that. I do not come from UIKit and come from SwiftUI, through a mix of ChatGPT and Stack overflow, I have come up with this solution, however, are there any better/simpler ones, I dont want to have to use expensive GeoReaders just to get a width. struct AutoDetectedPhoneNumberView: UIViewRepresentable { let text: String var width: CGFloat func makeUIView(context: Context) -> UITextView { let textView = UITextView() textView.dataDetectorTypes = [.phoneNumber] textView.isEditable = false textView.isScrollEnabled = false textView.backgroundColor = .clear textView.font = UIFont.systemFont(ofSize: 16) textView.textContainer.lineBreakMode = .byWordWrapping textView.translatesAutoresizingMaskIntoConstraints = false print(width) NSLayoutConstraint.activate([ textView.widthAnchor.constraint(equalToConstant: width) ]) return textView } func updateUIView(_ uiView: UITextView, context: Context) { uiView.text = text } } GeometryReader { geo in AutoDetectedPhoneNumberView(text: phone, width: geo.size.width) }
0
0
80
Jul ’25
Right bar button items in iOS 26 visual presentation
I have attached two images of two screens below. In one screen, bar button are enclosed within separate, distinct, rounded-rectangle 'liquid glass' capsules. In other screen, bar buttons are enclosed within separate, distinct, rounded-rectangle "liquid glass" capsules. They are not visually merged into one larger capsule. Both are having same code. But why it is not same ?
1
0
93
Jul ’25