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

iPadOS 26.1: new issue with traitCollection when changing dark mode
Since iPadOS 26.1 I notice a new annoying bug when changing the dark mode option of the system. The appearance of the UI changes, but no longer for view controllers which are presented as Popover. For these view controllers the method "traitCollectionDidChange()" is still called (though sometimes with a very large delay), but checking the traitCollection property of the view controller in there does no longer return the correct appearance (which is probably why the visual appearance of the popover doesn't change anymore). So if the dark mode was just switched on, traitCollectionDidChange() is called, but the "traitCollection.userInterfaceStyle" property still tells me that the system is in normal mode. More concrete, traitCollection.userInterfaceStyle seems to be set correctly only(!) when opening the popover, and while the popover is open, it is never updated anymore when the dark mode changes. This is also visible in the standard Apps of the iPad, like the Apple Maps App: just tap on the "map" icon at the top right to open the "Map mode" view. While the view is open, change the dark mode. All of the Maps App will change its appearance, with the exception of this "Map mode" view. Does anyone know an easy workaround? Or do I really need to manually change the colors for all popup view controllers whenever the dark mode changes? Using dynamic UIColors won't help, because these rely on the "userInterfaceStyle" property, and this is no longer correct. Bugreport: FB20928471
4
2
434
8h
UIView + CATiledLayer + SwiftUI Hosting + iOS 26 = Crash?
Our app uses a UIView backed by a CATiledLayer that is embedded in a UIScrollView, to represent a large document viewer. (PDF data, actually.) It needs to be big - far too big to allocate a single layer, and it needs to be able to reveal more detail as you zoom in. This is the exact use case for a CATiledLayer. CATiledLayer does its drawing on a background thread, as you know, and we've always taken care to make our draw method thread-safe. It has worked great for us, for over a decade now. However, starting with iOS 26, we've been having some surprising crashes. It looks like our CATiledLayer (I think?) is trying to trigger a layout on the background thread as well. This is frustrating because it doesn't have any subviews or sublayers - there's no reason for it. I'm suspecting the CATiledLayer because it does its drawing on a thread, so maybe it would also do other things there, but honestly, I'm not sure - it's hard to tell. Here's the crash. Normally with a crash like this, the solution is to bounce your layout call out to the main thread, but in our case, I'm not the one calling the layout function. The system (Core Animation) is doing it, and I can't figure out what I might be doing that is triggering it. Everything I am doing is on the main thread, and there's none of my code in this stack trace. It's possible this may have something to do with the SwiftUI hosting view, as well? There's definitely one of those involved here - our custom PDF viewer is embedded in one. (That's another reason to suspect the CATiledLayer - whatever is crashing here is in a SwiftUI hosting view, and the PDF viewer is just about the only UIKit on the screen, here, embedded in a hosting view.) I also have a test app that is pure UIKit, where I have not been able to reproduce the crash. I've tried subclassing CATiledLayer and having an empty implementation of updateSublayers, and some other, similar hacks along those lines, but nothing I do seems to help. I'm tempted to try moving from CATiledLayer to simple UIViews, and tiling those myself, but that's a lot of work. I want to be sure there's not some other solution before I try something like that. Is CATiledLayer still a supported mechanism or should I be moving away from it? If it is something entirely different that is crashing here, I don't want to do a bunch of rework of the PDF viewer only to end up with the same results. It really smells like a UIKit bug to me, or at least UIKit making some concurrency assumptions that CATiledLayer is breaking. But all I can really do is guess. *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Modifications to the layout engine must not be performed from a background thread after it has been accessed from the main thread.' *** First throw call stack: ( 0 CoreFoundation 0x00000001804f7348 __exceptionPreprocess + 172 1 libobjc.A.dylib 0x000000018009c094 objc_exception_throw + 72 2 CoreAutoLayout 0x000000022d3cc13c __36-[NSISEngine rebuildFromConstraints]_block_invoke + 0 3 CoreAutoLayout 0x000000022d3cbee0 -[NSISEngine _optimizeWithoutRebuilding] + 68 4 CoreAutoLayout 0x000000022d3cbe14 -[NSISEngine optimize] + 92 5 CoreAutoLayout 0x000000022d3c8744 -[NSISEngine performPendingChangeNotifications] + 100 6 UIKitCore 0x00000001869c7e7c -[UIView(Hierarchy) layoutSubviews] + 132 7 SwiftUI 0x00000001ddb40318 $s7SwiftUI14_UIHostingViewC14layoutSubviewsyyF + 68 8 SwiftUI 0x00000001ddb40358 $s7SwiftUI14_UIHostingViewC14layoutSubviewsyyFTo + 32 9 UIKitCore 0x0000000185642d34 block_destroy_helper.13 + 10136 10 UIKitCore 0x00000001856430c8 block_destroy_helper.13 + 11052 11 UIKitCore 0x00000001869d6ff4 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 2656 12 QuartzCore 0x000000018c8fd194 _ZN2CA5Layer15perform_update_EPS0_P7CALayerjNS_17LayerUpdateReasonEPNS_11TransactionE + 452 13 QuartzCore 0x000000018c8fc9e4 _ZN2CA5Layer17update_if_needed_EPNS_11TransactionENS_17LayerUpdateReasonE + 600 14 QuartzCore 0x000000018c908674 _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 152 15 QuartzCore 0x000000018c81d914 _ZN2CA7Context18commit_transactionEPNS_11TransactionEdPd + 544 16 QuartzCore 0x000000018c84da48 _ZN2CA11Transaction6commitEv + 636 17 QuartzCore 0x000000018c89ea8c _ZL21CAImageProviderThreadPjb + 1004 18 libdispatch.dylib 0x00000001033d59dc _dispatch_client_callout + 12 19 libdispatch.dylib 0x00000001033bf728 _dispatch_continuation_pop + 740 20 libdispatch.dylib 0x00000001033f3344 _dispatch_async_redirect_invoke + 700 21 libdispatch.dylib 0x00000001033cf470 _dispatch_root_queue_drain + 356 22 libdispatch.dylib 0x00000001033cffc4 _dispatch_worker_thread2 + 272 23 libsystem_pthread.dylib 0x0000000103276b50 _pthread_wqthread + 228 24 libsystem_pthread.dylib 0x000000010327598c start_wqthread + 8 ) libc++abi: terminating due to uncaught exception of type NSException
Topic: UI Frameworks SubTopic: UIKit
1
0
36
15h
iOS 26 WKWebView STScreenTimeConfigurationObserver KVO Crash
Fatal Exception: NSInternalInconsistencyException Cannot remove an observer <WKWebView 0x135137800> for the key path "configuration.enforcesChildRestrictions" from <STScreenTimeConfigurationObserver 0x13c6d7460>, most likely because the value for the key "configuration" has changed without an appropriate KVO notification being sent. Check the KVO-compliance of the STScreenTimeConfigurationObserver [class.] I noticed that on iOS 26, WKWebView registers STScreenTimeConfigurationObserver, Is this an iOS 26 system issue? What should I do?
Topic: UI Frameworks SubTopic: UIKit Tags:
16
17
1.7k
1d
UISheetPresentationController Disable Liquid Glass For Foreground Elements Within a Sheet
Hello just wondering if there is a supported way to disable the liquid glass effect that is passed down to every subview within a sheet using the medium or smaller detents? There are certain views with information in them within this sheet that I do not want to become semi transparent but I want to keep the background view of the sheet using the default liquid glass effect.
Topic: UI Frameworks SubTopic: UIKit Tags:
0
0
97
5d
The largeTitle of UINavigationBar disappears after scrolling on iOS 26.1
My project uses the UINavigationController's largeTitle on the latest iOS 26.1, but I found that when I set the backgroundColor, the navigation bar's largeTitle disappeared after switching between normal and large titles. I checked the latest documentation and consulted AI, but I have not found any good solutions. For the demo project, please refer to FB20986869
3
0
383
5d
Incorrect system color on popover view, and does not update while switching dark mode on iOS 26 beta 3
All system colors are displayed incorrectly on the popover view. Those are the same views present as a popover in light and dark mode. And those are the same views present as modal. And there is also a problem that when the popover is presented, switching to dark/light mode will not change the appearance. That affected all system apps. The following screenshot is already in dark mode. All those problem are occured on iOS 26 beta 3.
8
0
991
5d
iPadOS 26: How to prevent new scene creation when sharing a file to my app?
Many different types of files can be opened in my app. If a user, for example, views a file in the Files app and chooses to share the file, they can select my app from the list of options. My app is then given a chance to handle the file as needed. This works just fine in most cases. However, on iPadOS 26, if the user has set the iPad's Multitasking to either Windowed Apps or Stage Manager, then any time they choose to share a file with my app, a new scene (and window) is created. The user is usually not even aware that more and more windows/scenes are being created. It's only after they long-press on the app icon and select Show All Windows (or look under the Open Windows section) do they see far more windows than expected. Under iPadOS 17, 18, or with 26 set to Full Screen Apps, sharing a file to my app simply uses an existing scene, even if the user has explicitly created multiple scenes. A new scene is never created when sharing a file to my app unless there is no existing scene. Due to the nature of my app, even if the user has setup the iPad with Windowed App or Stage Manager under iPadOS 26, it would be far better if a new scene was not created and an existing scene was used. In other words, have it behave just as it does under iPadOS 17 or 18, or with 26 set as Full Screen Apps. Is there any way to configure an app to always use an existing scene when a file is shared with the app? My app is written with UIKit. Under iPadOS 26 with multitasking set to Windowed Apps or Stage Manager, sharing a file with my app results in the UIApplicationDelegate method application(_:configurationForConnecting:options:) being called. At this point a new scene is already in the process of being created. I don't see anything that can be set in the Info.plist. I do not see any relevant UIApplicationDelegate methods. Am I missing something or is this not possible?
0
0
72
6d
Is it a bug in UIActivityViewController to Airdrop ?
Context: Xcode 26.3, iOS 18.7.6 on iPhone Xs In this iOS app, I call UIActivityViewController to let user Airdrop files from the app. When trying to send a URL whose file name contains some characters like accentuated (-, é, '), the transfer fails. Removing those characters makes it work without problem. The same app running on Mac (in iPad mode) works with both cases. I also noticed that even when airdrop fails, there is no error reported by activityVC.completionWithItemsHandler = { activity, success, items, error in } Are those known issues ?
Topic: UI Frameworks SubTopic: UIKit Tags:
4
0
254
6d
Layout glitch after rotation when using UIWindowScene sizeRestrictions on iPadOS 26
Hi everyone, I am experiencing a strange rendering issue on iPadOS 26 when sizeRestrictions.minimumSize is set on a UIWindowScene. After rotating the device and then rotating it back to the original orientation, the window appears to be stretched based on its previous dimensions. This resulting "stretched" area does not resize or redraw correctly, leaving a significant black region on the screen. Interestingly, as soon as I interact with the window (e.g., a slight drag or touch), the UI snaps back to its intended state and redraws perfectly. Here is a sample code and capture of behavior. class SceneDelegate: UIResponder, UIWindowSceneDelegate { var window: UIWindow? func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) { guard let windowScene = (scene as? UIWindowScene) else { return } windowScene.sizeRestrictions?.minimumSize = CGSize( width: 390, height: 844 // larger than the height of iPad in landscape ) // initialize... } } Has anyone else encountered this behavior? If so, are there any known workarounds to force a layout refresh or prevent this "ghost" black area during the rotation transition? Any insights would be greatly appreciated. Thanks!
0
0
86
6d
UIDocumentPickerViewController allows to select file declared in Info.plist document types even when restricting to folder UTI
My document-based UIKit app can open plain text files such as .txt files. When tapping a particular button I want to be able to select a folder, but when using the code below, the document picker allows me to select folders as well as .txt files: class DocumentViewController: UIDocumentViewController, UIDocumentPickerDelegate { override func viewDidAppear(_ animated: Bool) { let documentPicker = UIDocumentPickerViewController(forOpeningContentTypes: [.folder]) documentPicker.delegate = self present(documentPicker, animated: true) } } If I remove the text file entry from the Info.plist's document types list, it works as expected. Is this a bug and if yes, is there a workaround? <key>CFBundleDocumentTypes</key> <array> <dict> <key>CFBundleTypeName</key> <string>Text</string> <key>CFBundleTypeRole</key> <string>Editor</string> <key>LSHandlerRank</key> <string>Default</string> <key>LSItemContentTypes</key> <array> <string>public.text</string> </array> </dict> </array> I created FB22254960.
Topic: UI Frameworks SubTopic: UIKit Tags:
2
0
144
1w
Korean IME forces Smart Quotes, ignoring UITextInputTraits and OS Settings
There is a long-standing, structural issue with the iPadOS Korean IME when using a hardware keyboard. The IME forcibly intercepts the " (quote) keydown event and injects Unicode smart/curved quotes (“ or ”) directly into the text field. This hardcoded behavior ignores both: User Settings: The global "Smart Punctuation" toggle in [Settings > General > Keyboard] is completely ignored. Developer APIs: Setting UITextInputTraits.smartQuotesType = .no on a UITextView or UITextField has absolutely no effect when the Korean keyboard is active. Steps to Reproduce: Set smartQuotesType = .no on a standard UITextView. Connect a hardware keyboard. Switch input language to English -> Press the quote key. (Result: ASCII straight quote " - Correct behavior) Switch input language to Korean -> Press the quote key. (Result: Unicode curved quote “ - Incorrect behavior) Impact on Developers & Users: Because the OS IME forcefully injects the curved Unicode character before the app can process the raw key event, developers building code editors, markdown editors, or specific word processors (like Google Docs) cannot prevent this behavior. We cannot provide a standard text-editing experience for Korean users without forcing them to manually toggle their keyboard language to English just to type a straight quote. Expected Behavior: The Korean hardware keyboard IME must respect UITextInputTraits.smartQuotesType and the global OS toggle. Please provide a mechanism for developers and users to bypass this forced CJK typography rule.
1
0
58
1w
Korean IME forces Smart Quotes, ignoring UITextInputTraits and OS Settings
There is a long-standing, structural issue with the iPadOS Korean IME when using a hardware keyboard. The IME forcibly intercepts the " (quote) keydown event and injects Unicode smart/curved quotes (“ or ”) directly into the text field. This hardcoded behavior ignores both: User Settings: The global "Smart Punctuation" toggle in [Settings > General > Keyboard] is completely ignored. Developer APIs: Setting UITextInputTraits.smartQuotesType = .no on a UITextView or UITextField has absolutely no effect when the Korean keyboard is active. Steps to Reproduce: Set smartQuotesType = .no on a standard UITextView. Connect a hardware keyboard. Switch input language to English -> Press the quote key. (Result: ASCII straight quote " - Correct behavior) Switch input language to Korean -> Press the quote key. (Result: Unicode curved quote “ - Incorrect behavior) Impact on Developers & Users: Because the OS IME forcefully injects the curved Unicode character before the app can process the raw key event, developers building code editors, markdown editors, or specific word processors (like Google Docs) cannot prevent this behavior. We cannot provide a standard text-editing experience for Korean users without forcing them to manually toggle their keyboard language to English just to type a straight quote. Expected Behavior: The Korean hardware keyboard IME must respect UITextInputTraits.smartQuotesType and the global OS toggle. Please provide a mechanism for developers and users to bypass this forced CJK typography rule.
Topic: UI Frameworks SubTopic: UIKit
0
0
72
1w
Wrong appearance of decimalPad keyboard in dark mode
Hi. The following code causes UI mismatch on iOS26. Keyboard with type decimalPad and appearance as dark is displayed as popUp with wrong colors. Before iOS26 keyboard was regular with correct color scheme. Please advice either how to make the scheme correct or force to display regular keyboard instead of popup. class ViewController: UIViewController { @IBOutlet weak var textField: UITextField! override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view. textField.keyboardType = .decimalPad textField.keyboardAppearance = .dark view.backgroundColor = .darkGray } }
6
1
317
1w
CarPlay: CPListImageRowItem images and CPNowPlayingTemplate buttons occasionally not displaying (requires device reboot)
Device: iPhone 17 Pro Max iOS version: iOS 26.3 CarPlay type: Wired We are encountering two intermittent UI issues in CarPlay when running our music application. The problems occur occasionally and cannot be recovered without restarting the device. Issue 1: CPListImageRowItem image not displaying On the CarPlay home page, some images occasionally fail to appear. Implementation details: The list is updated using CPListTemplate.updateSections. Each item is a CPListImageRowItem. On iOS versions below 26, images are updated using updateImages. On iOS 26, images are provided through CPListImageRowItem.elements, where each element is a CPListImageRowItemRowElement. Observed behavior: Logs confirm that the data is correctly provided. However, in failing cases the CPListImageRowItemRowElement appears with both title and subtitle equal to nil. The image is not rendered in the UI even though the item exists. Issue 2: Now Playing bottom buttons occasionally missing On the Now Playing screen, the bottom control buttons sometimes fail to appear. Implementation details: Buttons are updated using CPNowPlayingTemplate.updateNowPlayingButtons. The buttons are instances of CPNowPlayingImageButton. Observed behavior: Occasionally the buttons are not displayed. Once this occurs, the UI does not recover. Restarting the phone immediately resolves the issue. Additional observations The issue appears to occur intermittently. Once triggered, it persists until the device is rebooted. Similar behavior has been observed in other music apps (for example, QQ Music). Questions Are there known CarPlay UI rendering issues related to CPListImageRowItem or CPNowPlayingTemplate in recent iOS versions? Is there any recommended workaround or lifecycle handling that might prevent these UI elements from failing to render? Any guidance would be greatly appreciated.
Topic: UI Frameworks SubTopic: UIKit Tags:
1
0
55
1w
iOS 26: default gray background on UITabBarItem
In iOS 26, when a UITabBarItem is selected, a gray background appears behind the selected item. This seems to happen automatically with the new tab bar design. I tried configuring the tab bar using UITabBarAppearance, but the background highlight still appears. Is this the expected behavior in iOS 26 or is there a recommended way to configure the tab bar so that only the icon and title change color when selected?
Topic: UI Frameworks SubTopic: UIKit
4
0
269
2w
Switching to custom keyboard size glitches
I've created a custom keyboard and implemented the: class KeyboardViewController: UIInputViewController The imlementation looks like this: override func viewDidLoad() { super.viewDidLoad() var stack = UIStackView() stack.axis = .vertical stack.spacing = 8 stack.translatesAutoresizingMaskIntoConstraints = false stack.distribution = .fill stack.heightAnchor.constraint(equalToConstant: 200).isActive = true .... view.addSubview(stack) NSLayoutConstraint.activate([ stack.leadingAnchor.constraint(equalTo: view.leadingAnchor, constant: 20), stack.trailingAnchor.constraint(equalTo: view.trailingAnchor, constant: -20), stack.topAnchor.constraint(equalTo: view.topAnchor, constant: 10), stack.bottomAnchor.constraint(equalTo: view.bottomAnchor, constant: -10) ]) The problem is that the keyboard seems to start showing in the size (I've printed the parent frame): Optional(<UIView: 0x101008480; frame = (0 0; 390 844); autoresize = W+H; layer = <CALayer: 0x600000207b80>>) and than resizes to my given height. But it's not fast enough so that I can see some glitches whenever I switch from another keyboard to my custom keyboard. Is there a way to prevent this resizing or start the keyboard in a given size? This is just not the best user experience.
Topic: UI Frameworks SubTopic: UIKit
2
2
215
2w
Putting 2 existing pdf pages side by side (half size) in a new pdf
In Swift, iOS, I have a pdf file. I want to take the pages 2 by 2 and put them side by side, on the new page. For this, I have to scale initial pages half size and rotate .pi/2. I managed to achieve this by converting pdf pages to UIImages and using a UIGraphicsImageRenderer. But with a critical loss of resolution. I've tried improving the resolution by creating images as jpegData(withCompressionQuality: 1.0), to no avail. So I would need to work directly on the pdf pages using CGPDFDocument format. The code structure is as follows, to insert a single scaled page: for iPage in … { if let _page = theCGPdfDocument.page(at: 1) { var _pageRect: CGRect = _page.getBoxRect(CGPDFBox.mediaBox) writeContextInDestination!.beginPage(mediaBox: &_pageRect) // translate to compensate for the flip caused displacement writeContextInDestination!.translateBy(x: _pageRect.size.width, y: _pageRect.size.height) Scale (-1, -1) // rotate 180° // add rotate as needed writeContextInDestination!.scaleBy(x: -1, y: -1) writeContextInDestination!.clip(to: _pageRect) writeContextInDestination!.drawPDFPage(_page) writeContextInDestination!.endPage() // end the current page } } writeContextInDestination!.closePDF() But I do not succeed in inserting the drawing of the second page. I've tried repeating lines 7 to 11 for a second page at line 13. No success. What is the direction to look for ?
1
0
201
2w
touchesEnded: not triggered on newer iOS when view is inside UIScrollView (was working on iOS 18)
Hi everyone, I’m facing an issue with touch handling on newer iOS versions. I have a custom view controller implemented in Objective-C that overrides touchesEnded:. The same code works correctly on iOS 18, but on newer iOS versions (tested on iOS 26), touchesEnded: is no longer being triggered. Important observations: touchesBegan: is triggered. touchesEnded: is NOT triggered. touchesCancelled: is also NOT triggered. No code changes were made between iOS 18 and iOS 26. Same code, same sample works fine in iOS18 device but not in iOS26 device Questions: Has gesture arbitration behavior changed in recent iOS 26 versions when views are inside UIScrollView? Any clarification on whether this is intended behavior or a regression would be greatly appreciated. Thank you.
Topic: UI Frameworks SubTopic: UIKit
6
0
305
2w
iPadOS 26.1: new issue with traitCollection when changing dark mode
Since iPadOS 26.1 I notice a new annoying bug when changing the dark mode option of the system. The appearance of the UI changes, but no longer for view controllers which are presented as Popover. For these view controllers the method "traitCollectionDidChange()" is still called (though sometimes with a very large delay), but checking the traitCollection property of the view controller in there does no longer return the correct appearance (which is probably why the visual appearance of the popover doesn't change anymore). So if the dark mode was just switched on, traitCollectionDidChange() is called, but the "traitCollection.userInterfaceStyle" property still tells me that the system is in normal mode. More concrete, traitCollection.userInterfaceStyle seems to be set correctly only(!) when opening the popover, and while the popover is open, it is never updated anymore when the dark mode changes. This is also visible in the standard Apps of the iPad, like the Apple Maps App: just tap on the "map" icon at the top right to open the "Map mode" view. While the view is open, change the dark mode. All of the Maps App will change its appearance, with the exception of this "Map mode" view. Does anyone know an easy workaround? Or do I really need to manually change the colors for all popup view controllers whenever the dark mode changes? Using dynamic UIColors won't help, because these rely on the "userInterfaceStyle" property, and this is no longer correct. Bugreport: FB20928471
Replies
4
Boosts
2
Views
434
Activity
8h
UIView + CATiledLayer + SwiftUI Hosting + iOS 26 = Crash?
Our app uses a UIView backed by a CATiledLayer that is embedded in a UIScrollView, to represent a large document viewer. (PDF data, actually.) It needs to be big - far too big to allocate a single layer, and it needs to be able to reveal more detail as you zoom in. This is the exact use case for a CATiledLayer. CATiledLayer does its drawing on a background thread, as you know, and we've always taken care to make our draw method thread-safe. It has worked great for us, for over a decade now. However, starting with iOS 26, we've been having some surprising crashes. It looks like our CATiledLayer (I think?) is trying to trigger a layout on the background thread as well. This is frustrating because it doesn't have any subviews or sublayers - there's no reason for it. I'm suspecting the CATiledLayer because it does its drawing on a thread, so maybe it would also do other things there, but honestly, I'm not sure - it's hard to tell. Here's the crash. Normally with a crash like this, the solution is to bounce your layout call out to the main thread, but in our case, I'm not the one calling the layout function. The system (Core Animation) is doing it, and I can't figure out what I might be doing that is triggering it. Everything I am doing is on the main thread, and there's none of my code in this stack trace. It's possible this may have something to do with the SwiftUI hosting view, as well? There's definitely one of those involved here - our custom PDF viewer is embedded in one. (That's another reason to suspect the CATiledLayer - whatever is crashing here is in a SwiftUI hosting view, and the PDF viewer is just about the only UIKit on the screen, here, embedded in a hosting view.) I also have a test app that is pure UIKit, where I have not been able to reproduce the crash. I've tried subclassing CATiledLayer and having an empty implementation of updateSublayers, and some other, similar hacks along those lines, but nothing I do seems to help. I'm tempted to try moving from CATiledLayer to simple UIViews, and tiling those myself, but that's a lot of work. I want to be sure there's not some other solution before I try something like that. Is CATiledLayer still a supported mechanism or should I be moving away from it? If it is something entirely different that is crashing here, I don't want to do a bunch of rework of the PDF viewer only to end up with the same results. It really smells like a UIKit bug to me, or at least UIKit making some concurrency assumptions that CATiledLayer is breaking. But all I can really do is guess. *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Modifications to the layout engine must not be performed from a background thread after it has been accessed from the main thread.' *** First throw call stack: ( 0 CoreFoundation 0x00000001804f7348 __exceptionPreprocess + 172 1 libobjc.A.dylib 0x000000018009c094 objc_exception_throw + 72 2 CoreAutoLayout 0x000000022d3cc13c __36-[NSISEngine rebuildFromConstraints]_block_invoke + 0 3 CoreAutoLayout 0x000000022d3cbee0 -[NSISEngine _optimizeWithoutRebuilding] + 68 4 CoreAutoLayout 0x000000022d3cbe14 -[NSISEngine optimize] + 92 5 CoreAutoLayout 0x000000022d3c8744 -[NSISEngine performPendingChangeNotifications] + 100 6 UIKitCore 0x00000001869c7e7c -[UIView(Hierarchy) layoutSubviews] + 132 7 SwiftUI 0x00000001ddb40318 $s7SwiftUI14_UIHostingViewC14layoutSubviewsyyF + 68 8 SwiftUI 0x00000001ddb40358 $s7SwiftUI14_UIHostingViewC14layoutSubviewsyyFTo + 32 9 UIKitCore 0x0000000185642d34 block_destroy_helper.13 + 10136 10 UIKitCore 0x00000001856430c8 block_destroy_helper.13 + 11052 11 UIKitCore 0x00000001869d6ff4 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 2656 12 QuartzCore 0x000000018c8fd194 _ZN2CA5Layer15perform_update_EPS0_P7CALayerjNS_17LayerUpdateReasonEPNS_11TransactionE + 452 13 QuartzCore 0x000000018c8fc9e4 _ZN2CA5Layer17update_if_needed_EPNS_11TransactionENS_17LayerUpdateReasonE + 600 14 QuartzCore 0x000000018c908674 _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 152 15 QuartzCore 0x000000018c81d914 _ZN2CA7Context18commit_transactionEPNS_11TransactionEdPd + 544 16 QuartzCore 0x000000018c84da48 _ZN2CA11Transaction6commitEv + 636 17 QuartzCore 0x000000018c89ea8c _ZL21CAImageProviderThreadPjb + 1004 18 libdispatch.dylib 0x00000001033d59dc _dispatch_client_callout + 12 19 libdispatch.dylib 0x00000001033bf728 _dispatch_continuation_pop + 740 20 libdispatch.dylib 0x00000001033f3344 _dispatch_async_redirect_invoke + 700 21 libdispatch.dylib 0x00000001033cf470 _dispatch_root_queue_drain + 356 22 libdispatch.dylib 0x00000001033cffc4 _dispatch_worker_thread2 + 272 23 libsystem_pthread.dylib 0x0000000103276b50 _pthread_wqthread + 228 24 libsystem_pthread.dylib 0x000000010327598c start_wqthread + 8 ) libc++abi: terminating due to uncaught exception of type NSException
Topic: UI Frameworks SubTopic: UIKit
Replies
1
Boosts
0
Views
36
Activity
15h
iOS 26 WKWebView STScreenTimeConfigurationObserver KVO Crash
Fatal Exception: NSInternalInconsistencyException Cannot remove an observer <WKWebView 0x135137800> for the key path "configuration.enforcesChildRestrictions" from <STScreenTimeConfigurationObserver 0x13c6d7460>, most likely because the value for the key "configuration" has changed without an appropriate KVO notification being sent. Check the KVO-compliance of the STScreenTimeConfigurationObserver [class.] I noticed that on iOS 26, WKWebView registers STScreenTimeConfigurationObserver, Is this an iOS 26 system issue? What should I do?
Topic: UI Frameworks SubTopic: UIKit Tags:
Replies
16
Boosts
17
Views
1.7k
Activity
1d
UISheetPresentationController Disable Liquid Glass For Foreground Elements Within a Sheet
Hello just wondering if there is a supported way to disable the liquid glass effect that is passed down to every subview within a sheet using the medium or smaller detents? There are certain views with information in them within this sheet that I do not want to become semi transparent but I want to keep the background view of the sheet using the default liquid glass effect.
Topic: UI Frameworks SubTopic: UIKit Tags:
Replies
0
Boosts
0
Views
97
Activity
5d
The largeTitle of UINavigationBar disappears after scrolling on iOS 26.1
My project uses the UINavigationController's largeTitle on the latest iOS 26.1, but I found that when I set the backgroundColor, the navigation bar's largeTitle disappeared after switching between normal and large titles. I checked the latest documentation and consulted AI, but I have not found any good solutions. For the demo project, please refer to FB20986869
Replies
3
Boosts
0
Views
383
Activity
5d
Incorrect system color on popover view, and does not update while switching dark mode on iOS 26 beta 3
All system colors are displayed incorrectly on the popover view. Those are the same views present as a popover in light and dark mode. And those are the same views present as modal. And there is also a problem that when the popover is presented, switching to dark/light mode will not change the appearance. That affected all system apps. The following screenshot is already in dark mode. All those problem are occured on iOS 26 beta 3.
Replies
8
Boosts
0
Views
991
Activity
5d
iPadOS 26: How to prevent new scene creation when sharing a file to my app?
Many different types of files can be opened in my app. If a user, for example, views a file in the Files app and chooses to share the file, they can select my app from the list of options. My app is then given a chance to handle the file as needed. This works just fine in most cases. However, on iPadOS 26, if the user has set the iPad's Multitasking to either Windowed Apps or Stage Manager, then any time they choose to share a file with my app, a new scene (and window) is created. The user is usually not even aware that more and more windows/scenes are being created. It's only after they long-press on the app icon and select Show All Windows (or look under the Open Windows section) do they see far more windows than expected. Under iPadOS 17, 18, or with 26 set to Full Screen Apps, sharing a file to my app simply uses an existing scene, even if the user has explicitly created multiple scenes. A new scene is never created when sharing a file to my app unless there is no existing scene. Due to the nature of my app, even if the user has setup the iPad with Windowed App or Stage Manager under iPadOS 26, it would be far better if a new scene was not created and an existing scene was used. In other words, have it behave just as it does under iPadOS 17 or 18, or with 26 set as Full Screen Apps. Is there any way to configure an app to always use an existing scene when a file is shared with the app? My app is written with UIKit. Under iPadOS 26 with multitasking set to Windowed Apps or Stage Manager, sharing a file with my app results in the UIApplicationDelegate method application(_:configurationForConnecting:options:) being called. At this point a new scene is already in the process of being created. I don't see anything that can be set in the Info.plist. I do not see any relevant UIApplicationDelegate methods. Am I missing something or is this not possible?
Replies
0
Boosts
0
Views
72
Activity
6d
Is it a bug in UIActivityViewController to Airdrop ?
Context: Xcode 26.3, iOS 18.7.6 on iPhone Xs In this iOS app, I call UIActivityViewController to let user Airdrop files from the app. When trying to send a URL whose file name contains some characters like accentuated (-, é, '), the transfer fails. Removing those characters makes it work without problem. The same app running on Mac (in iPad mode) works with both cases. I also noticed that even when airdrop fails, there is no error reported by activityVC.completionWithItemsHandler = { activity, success, items, error in } Are those known issues ?
Topic: UI Frameworks SubTopic: UIKit Tags:
Replies
4
Boosts
0
Views
254
Activity
6d
Layout glitch after rotation when using UIWindowScene sizeRestrictions on iPadOS 26
Hi everyone, I am experiencing a strange rendering issue on iPadOS 26 when sizeRestrictions.minimumSize is set on a UIWindowScene. After rotating the device and then rotating it back to the original orientation, the window appears to be stretched based on its previous dimensions. This resulting "stretched" area does not resize or redraw correctly, leaving a significant black region on the screen. Interestingly, as soon as I interact with the window (e.g., a slight drag or touch), the UI snaps back to its intended state and redraws perfectly. Here is a sample code and capture of behavior. class SceneDelegate: UIResponder, UIWindowSceneDelegate { var window: UIWindow? func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) { guard let windowScene = (scene as? UIWindowScene) else { return } windowScene.sizeRestrictions?.minimumSize = CGSize( width: 390, height: 844 // larger than the height of iPad in landscape ) // initialize... } } Has anyone else encountered this behavior? If so, are there any known workarounds to force a layout refresh or prevent this "ghost" black area during the rotation transition? Any insights would be greatly appreciated. Thanks!
Replies
0
Boosts
0
Views
86
Activity
6d
UIDocumentPickerViewController allows to select file declared in Info.plist document types even when restricting to folder UTI
My document-based UIKit app can open plain text files such as .txt files. When tapping a particular button I want to be able to select a folder, but when using the code below, the document picker allows me to select folders as well as .txt files: class DocumentViewController: UIDocumentViewController, UIDocumentPickerDelegate { override func viewDidAppear(_ animated: Bool) { let documentPicker = UIDocumentPickerViewController(forOpeningContentTypes: [.folder]) documentPicker.delegate = self present(documentPicker, animated: true) } } If I remove the text file entry from the Info.plist's document types list, it works as expected. Is this a bug and if yes, is there a workaround? <key>CFBundleDocumentTypes</key> <array> <dict> <key>CFBundleTypeName</key> <string>Text</string> <key>CFBundleTypeRole</key> <string>Editor</string> <key>LSHandlerRank</key> <string>Default</string> <key>LSItemContentTypes</key> <array> <string>public.text</string> </array> </dict> </array> I created FB22254960.
Topic: UI Frameworks SubTopic: UIKit Tags:
Replies
2
Boosts
0
Views
144
Activity
1w
Is it safe to assume UIActivity is isolated to MainActor?
UIActivity is not annotated with concurrency information. Does anyone know if subclasses you create will always run on the @MainActor ?
Replies
1
Boosts
0
Views
86
Activity
1w
Korean IME forces Smart Quotes, ignoring UITextInputTraits and OS Settings
There is a long-standing, structural issue with the iPadOS Korean IME when using a hardware keyboard. The IME forcibly intercepts the " (quote) keydown event and injects Unicode smart/curved quotes (“ or ”) directly into the text field. This hardcoded behavior ignores both: User Settings: The global "Smart Punctuation" toggle in [Settings > General > Keyboard] is completely ignored. Developer APIs: Setting UITextInputTraits.smartQuotesType = .no on a UITextView or UITextField has absolutely no effect when the Korean keyboard is active. Steps to Reproduce: Set smartQuotesType = .no on a standard UITextView. Connect a hardware keyboard. Switch input language to English -> Press the quote key. (Result: ASCII straight quote " - Correct behavior) Switch input language to Korean -> Press the quote key. (Result: Unicode curved quote “ - Incorrect behavior) Impact on Developers & Users: Because the OS IME forcefully injects the curved Unicode character before the app can process the raw key event, developers building code editors, markdown editors, or specific word processors (like Google Docs) cannot prevent this behavior. We cannot provide a standard text-editing experience for Korean users without forcing them to manually toggle their keyboard language to English just to type a straight quote. Expected Behavior: The Korean hardware keyboard IME must respect UITextInputTraits.smartQuotesType and the global OS toggle. Please provide a mechanism for developers and users to bypass this forced CJK typography rule.
Replies
1
Boosts
0
Views
58
Activity
1w
Korean IME forces Smart Quotes, ignoring UITextInputTraits and OS Settings
There is a long-standing, structural issue with the iPadOS Korean IME when using a hardware keyboard. The IME forcibly intercepts the " (quote) keydown event and injects Unicode smart/curved quotes (“ or ”) directly into the text field. This hardcoded behavior ignores both: User Settings: The global "Smart Punctuation" toggle in [Settings > General > Keyboard] is completely ignored. Developer APIs: Setting UITextInputTraits.smartQuotesType = .no on a UITextView or UITextField has absolutely no effect when the Korean keyboard is active. Steps to Reproduce: Set smartQuotesType = .no on a standard UITextView. Connect a hardware keyboard. Switch input language to English -> Press the quote key. (Result: ASCII straight quote " - Correct behavior) Switch input language to Korean -> Press the quote key. (Result: Unicode curved quote “ - Incorrect behavior) Impact on Developers & Users: Because the OS IME forcefully injects the curved Unicode character before the app can process the raw key event, developers building code editors, markdown editors, or specific word processors (like Google Docs) cannot prevent this behavior. We cannot provide a standard text-editing experience for Korean users without forcing them to manually toggle their keyboard language to English just to type a straight quote. Expected Behavior: The Korean hardware keyboard IME must respect UITextInputTraits.smartQuotesType and the global OS toggle. Please provide a mechanism for developers and users to bypass this forced CJK typography rule.
Topic: UI Frameworks SubTopic: UIKit
Replies
0
Boosts
0
Views
72
Activity
1w
Partially disable liquid glass effect from navigation bars but retain on tabbar
I want to be able to disable all liquid glass effects from my Navigation bar, and it's bar buttons. But I still want to be able to have the liquid glass effect on my UITabbar. Is there a way to disable glass effects from navbar and still retain them all for tabbars using UIKit?
Replies
4
Boosts
2
Views
741
Activity
1w
Wrong appearance of decimalPad keyboard in dark mode
Hi. The following code causes UI mismatch on iOS26. Keyboard with type decimalPad and appearance as dark is displayed as popUp with wrong colors. Before iOS26 keyboard was regular with correct color scheme. Please advice either how to make the scheme correct or force to display regular keyboard instead of popup. class ViewController: UIViewController { @IBOutlet weak var textField: UITextField! override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view. textField.keyboardType = .decimalPad textField.keyboardAppearance = .dark view.backgroundColor = .darkGray } }
Replies
6
Boosts
1
Views
317
Activity
1w
CarPlay: CPListImageRowItem images and CPNowPlayingTemplate buttons occasionally not displaying (requires device reboot)
Device: iPhone 17 Pro Max iOS version: iOS 26.3 CarPlay type: Wired We are encountering two intermittent UI issues in CarPlay when running our music application. The problems occur occasionally and cannot be recovered without restarting the device. Issue 1: CPListImageRowItem image not displaying On the CarPlay home page, some images occasionally fail to appear. Implementation details: The list is updated using CPListTemplate.updateSections. Each item is a CPListImageRowItem. On iOS versions below 26, images are updated using updateImages. On iOS 26, images are provided through CPListImageRowItem.elements, where each element is a CPListImageRowItemRowElement. Observed behavior: Logs confirm that the data is correctly provided. However, in failing cases the CPListImageRowItemRowElement appears with both title and subtitle equal to nil. The image is not rendered in the UI even though the item exists. Issue 2: Now Playing bottom buttons occasionally missing On the Now Playing screen, the bottom control buttons sometimes fail to appear. Implementation details: Buttons are updated using CPNowPlayingTemplate.updateNowPlayingButtons. The buttons are instances of CPNowPlayingImageButton. Observed behavior: Occasionally the buttons are not displayed. Once this occurs, the UI does not recover. Restarting the phone immediately resolves the issue. Additional observations The issue appears to occur intermittently. Once triggered, it persists until the device is rebooted. Similar behavior has been observed in other music apps (for example, QQ Music). Questions Are there known CarPlay UI rendering issues related to CPListImageRowItem or CPNowPlayingTemplate in recent iOS versions? Is there any recommended workaround or lifecycle handling that might prevent these UI elements from failing to render? Any guidance would be greatly appreciated.
Topic: UI Frameworks SubTopic: UIKit Tags:
Replies
1
Boosts
0
Views
55
Activity
1w
iOS 26: default gray background on UITabBarItem
In iOS 26, when a UITabBarItem is selected, a gray background appears behind the selected item. This seems to happen automatically with the new tab bar design. I tried configuring the tab bar using UITabBarAppearance, but the background highlight still appears. Is this the expected behavior in iOS 26 or is there a recommended way to configure the tab bar so that only the icon and title change color when selected?
Topic: UI Frameworks SubTopic: UIKit
Replies
4
Boosts
0
Views
269
Activity
2w
Switching to custom keyboard size glitches
I've created a custom keyboard and implemented the: class KeyboardViewController: UIInputViewController The imlementation looks like this: override func viewDidLoad() { super.viewDidLoad() var stack = UIStackView() stack.axis = .vertical stack.spacing = 8 stack.translatesAutoresizingMaskIntoConstraints = false stack.distribution = .fill stack.heightAnchor.constraint(equalToConstant: 200).isActive = true .... view.addSubview(stack) NSLayoutConstraint.activate([ stack.leadingAnchor.constraint(equalTo: view.leadingAnchor, constant: 20), stack.trailingAnchor.constraint(equalTo: view.trailingAnchor, constant: -20), stack.topAnchor.constraint(equalTo: view.topAnchor, constant: 10), stack.bottomAnchor.constraint(equalTo: view.bottomAnchor, constant: -10) ]) The problem is that the keyboard seems to start showing in the size (I've printed the parent frame): Optional(<UIView: 0x101008480; frame = (0 0; 390 844); autoresize = W+H; layer = <CALayer: 0x600000207b80>>) and than resizes to my given height. But it's not fast enough so that I can see some glitches whenever I switch from another keyboard to my custom keyboard. Is there a way to prevent this resizing or start the keyboard in a given size? This is just not the best user experience.
Topic: UI Frameworks SubTopic: UIKit
Replies
2
Boosts
2
Views
215
Activity
2w
Putting 2 existing pdf pages side by side (half size) in a new pdf
In Swift, iOS, I have a pdf file. I want to take the pages 2 by 2 and put them side by side, on the new page. For this, I have to scale initial pages half size and rotate .pi/2. I managed to achieve this by converting pdf pages to UIImages and using a UIGraphicsImageRenderer. But with a critical loss of resolution. I've tried improving the resolution by creating images as jpegData(withCompressionQuality: 1.0), to no avail. So I would need to work directly on the pdf pages using CGPDFDocument format. The code structure is as follows, to insert a single scaled page: for iPage in … { if let _page = theCGPdfDocument.page(at: 1) { var _pageRect: CGRect = _page.getBoxRect(CGPDFBox.mediaBox) writeContextInDestination!.beginPage(mediaBox: &_pageRect) // translate to compensate for the flip caused displacement writeContextInDestination!.translateBy(x: _pageRect.size.width, y: _pageRect.size.height) Scale (-1, -1) // rotate 180° // add rotate as needed writeContextInDestination!.scaleBy(x: -1, y: -1) writeContextInDestination!.clip(to: _pageRect) writeContextInDestination!.drawPDFPage(_page) writeContextInDestination!.endPage() // end the current page } } writeContextInDestination!.closePDF() But I do not succeed in inserting the drawing of the second page. I've tried repeating lines 7 to 11 for a second page at line 13. No success. What is the direction to look for ?
Replies
1
Boosts
0
Views
201
Activity
2w
touchesEnded: not triggered on newer iOS when view is inside UIScrollView (was working on iOS 18)
Hi everyone, I’m facing an issue with touch handling on newer iOS versions. I have a custom view controller implemented in Objective-C that overrides touchesEnded:. The same code works correctly on iOS 18, but on newer iOS versions (tested on iOS 26), touchesEnded: is no longer being triggered. Important observations: touchesBegan: is triggered. touchesEnded: is NOT triggered. touchesCancelled: is also NOT triggered. No code changes were made between iOS 18 and iOS 26. Same code, same sample works fine in iOS18 device but not in iOS26 device Questions: Has gesture arbitration behavior changed in recent iOS 26 versions when views are inside UIScrollView? Any clarification on whether this is intended behavior or a regression would be greatly appreciated. Thank you.
Topic: UI Frameworks SubTopic: UIKit
Replies
6
Boosts
0
Views
305
Activity
2w