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

Change tint of back button in UINavigationItem on iOS 26
I am struggling to change the tint of the back button in an UINavigationItem. In iOS 18.6 it looks like this while on iOS 26 the same looks like this I can live without the Dictionary but I'd like to get the blue color back. In viewDidLoad() I have tried navigationItem.backBarButtonItem?.tintColor = .link but this did not work since navigationItem.backBarButtonItem is nil. My second attempt was navigationController?.navigationBar.tintColor = .link but this didn't work either. I have even set the Global Tint to Link Color but this had no effect either. Does anyone have an idea how to change the tint of the back button in an UINavigationItem on iOS 26?
Topic: UI Frameworks SubTopic: UIKit Tags:
0
0
3
6m
Detecting marked range in UI/NSTextViews at the time of shouldChangeTextIn
We have submitted a feedback for this issue: FB21230723 We're building a note-taking app for iOS and macOS that uses both UITextView and NSTextView. When performing text input that involves a marked range (such as Japanese input) in a UITextView or NSTextView with a UITextViewDelegate or NSTextViewDelegate set, the text view's marked range (markedTextRange / markedRange()) has not yet been updated at the moment when shouldChangeTextIn is invoked. UITextViewDelegate.textView(_:shouldChangeTextIn:replacementText:) NSTextViewDelegate.textView(_:shouldChangeTextIn:replacementString:) The current behavior is this when entering text in Japanese: (same for NSTextView) func textView(_ textView: UITextView, shouldChangeTextIn range: NSRange, replacementText text: String) -> Bool { print(textView.markedTextRange != nil) // prints out false DispatchQueue.main.async { print(textView.markedTextRange != nil) // prints out true } } However, we need the value of markedTextRange right away in order to determine whether to return true or false from this method. Is there any workaround for this issue?
4
0
275
1d
Navigation title is not visible in root of navigation stack of UITabBarController using UITab layout on iPad
Description Title of the view controller is not displayed for the 1st view controller in navigation stack. Is there a way to show it? Main problem is that selected tab is a UITabGroup and there's no way to understand which child of it is currently selected without opening the sidebar or guessing by the content. Human Interface Guidelines In the guidelines there are examples with title visible on the iPad in similar case: https://developer.apple.com/design/human-interface-guidelines/tab-bars Code import UIKit import SwiftUI struct TestView: View { var tab: UITab? let id = UUID() var body: some View { ScrollView { HStack { Spacer() VStack { Text(tab?.title ?? id.uuidString) } Spacer() } .frame(height: 1000) .background(.red) .onTapGesture { tab?.viewController?.navigationController?.pushViewController( TestViewController(nil), animated: true ) } } } } class TestViewController: UIHostingController<TestView> { let _tab: UITab? init(_ tab: UITab?) { self._tab = tab super.init(rootView: TestView(tab: _tab)) } @MainActor @preconcurrency required dynamic init?(coder aDecoder: NSCoder) { fatalError("init(coder:) has not been implemented") } override func viewDidLoad() { super.viewDidLoad() navigationItem.title = _tab?.title ?? "tab-nil" } } class ViewController: UITabBarController { override func viewDidLoad() { super.viewDidLoad() mode = .tabSidebar let provider: (UITab) -> UIViewController = { tab in print(tab) return TestViewController(tab) } let tab1 = UITabGroup( title: "Tab 1", image: UIImage(systemName: "1.square.fill"), identifier: "tab1", children: [ UITab(title: "Sub 1", image: UIImage(systemName: "1.circle"), identifier: "First Tab", viewControllerProvider: provider), UITab(title: "Sub 2", image: UIImage(systemName: "2.circle"), identifier: "Second Tab", viewControllerProvider: provider) ]) tab1.selectedChild = tab1.children[0] tab1.managingNavigationController = UINavigationController() let tab2 = UITabGroup( title: "Tab 2", image: UIImage(systemName: "2.square.fill"), identifier: "Section one", children: [ UITab( title: "Sub 1", image: UIImage(systemName: "a.circle"), identifier: "Section 1, item A", viewControllerProvider: provider), UITabGroup(title: "Sub Group", image: nil, identifier: "q", children: [ UITab( title: "Item 1", image: UIImage(systemName: "b.circle"), identifier: "c1", viewControllerProvider: provider), UITab( title: "Item 2", image: UIImage(systemName: "b.circle"), identifier: "c2", viewControllerProvider: provider) ], viewControllerProvider: provider ), ] ) tab2.selectedChild = tab2.children[0] tab2.managingNavigationController = UINavigationController() tabs = [ tab1, tab2, ] selectedTab = tab1 } }
Topic: UI Frameworks SubTopic: UIKit
3
0
189
2d
UIButtonConfiguration and button disabled state
I am trying to use the UIButtonConfiguration to set the UI state for the button.isEnabled status. I do see the ConfigurationUpdateHandler code below being executed but when the button.isEnabled is set to false, the UI does not reflect the updated backgroundColor. Instead it is a very light gray but the foregroundColor/text is being updated. It seems that the default disabled button treatment is being used despite being set to a different color. Is there a better way to suppress the default UIButton disabled state so I can customize? [newButton setConfigurationUpdateHandler:^(__kindof UIButton * _Nonnull button) { UIButtonConfiguration *updatedConfiguration; if (newButton.configuration != nil) { updatedConfiguration = newButton.configuration; if (button.isEnabled) { updatedConfiguration.baseBackgroundColor = [UIColor darkGrayColor]; updatedConfiguration.baseForegroundColor = [UIColor whiteColor]; } else { updatedConfiguration.baseBackgroundColor = [UIColor greenColor]; updatedConfiguration.baseForegroundColor = [UIColor blackColor]; } } button.configuration = updatedConfiguration; }];
Topic: UI Frameworks SubTopic: UIKit
1
0
124
2d
"canOpenURL:" on a thread that isn`t main thread?
When I call this method on a thread that isn`t thread. And chose main thread check on target, The Console show the world : Main Thread Checker: UI API called on a background thread: -[UIApplication canOpenURL:] PID: 8818, TID: 10191278, Thread name: (none), Queue name: com.myqueue.canopen, QoS: 0 Backtrace: 4 TestDemo 0x0000000102f6c068 __39-[AppTools isExists:]_block_invoke_3 + 892 5 CoreFoundation 0x000000019e22995c 7519E999-1053-3367-B9D5-8844F6D3BDC6 + 1042780 6 CoreFoundation 0x000000019e12ec98 7519E999-1053-3367-B9D5-8844F6D3BDC6 + 15512 7 TestDemo 0x0000000102f6bba0 __39-[AppTools isExists:]_block_invoke_2 + 424 8 libdispatch.dylib 0x0000000103a4d7fc _dispatch_call_block_and_release + 24 9 libdispatch.dylib 0x0000000103a4ebd8 _dispatch_client_callout + 16 10 libdispatch.dylib 0x0000000103a55b48 _dispatch_lane_serial_drain + 744 11 libdispatch.dylib 0x0000000103a566e4 _dispatch_lane_invoke + 448 12 libdispatch.dylib 0x0000000103a61adc _dispatch_workloop_worker_thread + 1324 13 libsystem_pthread.dylib 0x000000019df72b88 _pthread_wqthread + 276 14 libsystem_pthread.dylib 0x000000019df75760 start_wqthread + 8
1
0
66
2d
Setting alternate app icon fails with "Ressource temporarily not available"
Switching alternative app icons previously worked in my app and I did not notice when it broke. However now the completion handler consistently returns this error if feeding with either an existing app icon name or a fictional one. Is this a regression I should file a bug report for or am I doing something wrong here? Include all app icon assets is enabled in the target Below you can see the error, the .icon files placed in the project navigator, my code and the top of the Info.plist Thank you Button("Update icon") { UIApplication.shared.setAlternateIconName("appIcon_Heart") { error in if let error { print(error) } } } Error Domain=NSPOSIXErrorDomain Code=35 "Resource temporarily unavailable" UserInfo={_LSFile=LSIconAlertManager.m, _LSLine=113, _LSFunction=-[LSIconAlertManager iconChangeAlertTokenForIdentity:error:]} Xcode seems to create the correct Info.plist entries. <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>BGTaskSchedulerPermittedIdentifiers</key> <array> <string>newReleasesBackgroundTask</string> </array> <key>BuildMachineOSBuild</key> <string>24G90</string> <key>CFBundleDevelopmentRegion</key> <string>de</string> <key>CFBundleDisplayName</key> <string>Hörspielzentrale</string> <key>CFBundleExecutable</key> <string>Hoerspielzentrale</string> <key>CFBundleIcons</key> <dict> <key>CFBundleAlternateIcons</key> <dict> <key>appIcon_Heart</key> <dict> <key>CFBundleIconName</key> <string>appIcon_Heart</string> </dict> <key>appIcon_RedNoCircle</key> <dict> <key>CFBundleIconName</key> <string>appIcon_RedNoCircle</string> </dict> <key>appIcon_WhiteNoCircle</key> <dict> <key>CFBundleIconName</key> <string>appIcon_WhiteNoCircle</string> </dict> </dict> <key>CFBundlePrimaryIcon</key> <dict> <key>CFBundleIconFiles</key> <array> <string>AppIcon60x60</string> </array> <key>CFBundleIconName</key> <string>AppIcon</string> </dict> </dict> <key>CFBundleIcons~ipad</key> <dict> <key>CFBundleAlternateIcons</key> <dict> <key>appIcon_Heart</key> <dict> <key>CFBundleIconName</key> <string>appIcon_Heart</string> </dict> <key>appIcon_RedNoCircle</key> <dict> <key>CFBundleIconName</key> <string>appIcon_RedNoCircle</string> </dict> <key>appIcon_WhiteNoCircle</key> <dict> <key>CFBundleIconName</key> <string>appIcon_WhiteNoCircle</string> </dict> </dict> <key>CFBundlePrimaryIcon</key> <dict> <key>CFBundleIconFiles</key> <array> <string>AppIcon60x60</string> <string>AppIcon76x76</string> </array> <key>CFBundleIconName</key> <string>AppIcon</string> </dict> </dict>
Topic: UI Frameworks SubTopic: UIKit
1
1
63
3d
UISlider valueChanged has uninitialized UIEvent
This issue was in the first iOS 26 beta and it still there with Xcode 26 beta 6 (17A5305f). Feedback is FB18581605 and contains sample project to reproduce the issue. I assign a target and action to a UISlider for the UIControl.Event.valueChanged value: addTarget(self, action: #selector(sliderValueDidChange), for: .valueChanged) Here’s the function. @objc func sliderValueDidChange(_ sender: UISlider, event: UIEvent) { print(event) } When printing the event value, there is a crash. When checking the event value with lldb, it appears uninitialized.
Topic: UI Frameworks SubTopic: UIKit Tags:
13
6
1.1k
3d
ios26 NumberPad keyboard issue on iPad
On an iPad running iOS26, there is an issue with the numberPad keyboard I have a UITextField with a keyboard type of .numberPad When I first tap in the field, a new number pad with just numbers (similar to the one that shows up on iPhone) shows up. When I tap again in the field, that number pad goes away. When I tap in the field again, the full keyboard with numbers etc shows up (this is the one that used to always show up pre-iOS26)
Topic: UI Frameworks SubTopic: UIKit
5
1
449
3d
[UIKit Glass Effect] - Opacity change from 0 to 1 does not work
When a UIVisualEffect with glass effect view is added with opacity 0, it remains hidden as expected. But when changing it back to 1 should make it visible, but currently it stays hidden forever. The bug is only reproducible on iOS 26.1 and iOS 26.2. It does not happen on iOS 26.0. The issue is also not reproducible with UIBlurEffect. Only happens for Glass effect Here is the repro link
3
0
308
5d
DisplayRepresentation.Image(systemName:tintColor:) ignores or misapplies tintColor since iOS 18
DisplayRepresentation.Image(systemName:tintColor:symbolConfiguration:) no longer applies the provided tintColor reliably since iOS 18. Observed behavior by OS version: iOS 17: SF Symbol tint is applied consistently as expected. iOS 18: SF Symbol tint is inconsistent and sometimes appears with incorrect or seemingly random colors instead of the provided tintColor. iOS 26: SF Symbol is rendered without any tint (default monochrome), completely ignoring the provided tintColor. This appears to be a regression in how App Intents renders DisplayRepresentation.Image with tinting across OS versions. iOS17.5: iOS 18.6: iOS26: Code: import AppIntents import UIKit struct CategoryEntity: AppEntity, Hashable { var id: Category.ID var name: String var icon: Int? var color: Int? var parentCategoryName: String? init(from category: Category) { self.id = category.id self.name = category.name self.icon = category.icon self.color = category.parent?.color ?? category.color self.parentCategoryName = category.parent?.name } var displayRepresentation: DisplayRepresentation { DisplayRepresentation( title: "\(name)", subtitle: parentCategoryName.map { "\($0)" }, image: .init( systemName: Icon.sfSymbolName(from: icon), tintColor: ColorTag.from(color) ) ) } static let typeDisplayRepresentation: TypeDisplayRepresentation = "Category" static let defaultQuery = CategoryQuery() } [Documentation API] (https://developer.apple.com/documentation/appintents/displayrepresentation/image-swift.struct/init(systemname:tintcolor:symbolconfiguration:)-3snvy?changes=_5)
1
0
218
5d
Keyframe animation crashes with +[_SwiftUILayerDelegate _screen]: unrecognized selector sent to class on iOS 26
We have an UIViewController called InfoPlayerViewController. Its main subview is from a child view controller backed by SwiftUI via UIHostingController. The InfoPlayerViewController conforms to UIViewControllerTransitioningDelegate. The animation controller for dismissing is DismissPlayerAnimationController. It runs UIKit keyframe animations via UIViewPropertyAnimator. When the keyframe animation is executed there’s an occasional crash for end users in production. It only happens on iOS 26. FB Radar: FB20871547 An example crash is below. Exception Type: EXC_CRASH (SIGABRT) Exception Codes: 0x0000000000000000, 0x0000000000000000 Exception Reason: +[_SwiftUILayerDelegate _screen]: unrecognized selector sent to class 0x20c95da08 Termination Reason: SIGNAL 6 Abort trap: 6 Triggered by Thread: 0 Last Exception Backtrace: 0 CoreFoundation 0x1a23828c8 __exceptionPreprocess + 164 (NSException.m:249) 1 libobjc.A.dylib 0x19f2f97c4 objc_exception_throw + 88 (objc-exception.mm:356) 2 CoreFoundation 0x1a241e6cc +[NSObject(NSObject) doesNotRecognizeSelector:] + 364 (NSObject.m:158) 3 CoreFoundation 0x1a22ff4f8 ___forwarding___ + 1472 (NSForwarding.m:3616) 4 CoreFoundation 0x1a23073a0 _CF_forwarding_prep_0 + 96 (:-1) 5 UIKitCore 0x1a948e880 __35-[UIViewKeyframeAnimationState pop]_block_invoke + 300 (UIView.m:2973) 6 CoreFoundation 0x1a22cb170 __NSDICTIONARY_IS_CALLING_OUT_TO_A_BLOCK__ + 24 (NSDictionaryHelpers.m:10) 7 CoreFoundation 0x1a245d7cc -[__NSDictionaryM enumerateKeysAndObjectsWithOptions:usingBlock:] + 288 (NSDictionaryM.m:271) 8 UIKitCore 0x1a948e6bc -[UIViewKeyframeAnimationState pop] + 376 (UIView.m:2955) 9 UIKitCore 0x1a7bc40e8 +[UIViewAnimationState popAnimationState] + 60 (UIView.m:1250) 10 UIKitCore 0x1a94acc44 +[UIView(UIViewAnimationWithBlocks) _setupAnimationWithDuration:delay:view:options:factory:animations:start:animationStateGenerator:completion:] + 684 (UIView.m:17669) 11 UIKitCore 0x1a94ae334 +[UIView(UIViewKeyframeAnimations) animateKeyframesWithDuration:delay:options:animations:completion:] + 224 (UIView.m:17945) 12 MyApp 0x102c78dec static UIView.animateNestedKeyframe(withRelativeStartTime:relativeDuration:animations:) + 208 (UIView+AnimateNestedKeyframe.swift:10) 13 MyApp 0x102aef3c0 closure #1 in DismissPlayerAnimationController.slideDownBelowTabBarTransitionAnimator(using:) + 156 (DismissPlayerAnimationController.swift:229) 14 MyApp 0x102a2d3d4 <deduplicated_symbol> + 28 15 UIKitCore 0x1a7d5ae5c -[UIViewPropertyAnimator _runAnimations] + 172 (UIViewPropertyAnimator.m:2123) 16 UIKitCore 0x1a83e1594 __49-[UIViewPropertyAnimator startAnimationAsPaused:]_block_invoke_3 + 92 (UIViewPropertyAnimator.m:3557) 17 UIKitCore 0x1a83e1464 __49-[UIViewPropertyAnimator startAnimationAsPaused:]_block_invoke + 96 (UIViewPropertyAnimator.m:3547) 18 UIKitCore 0x1a83e1518 __49-[UIViewPropertyAnimator startAnimationAsPaused:]_block_invoke_2 + 144 (UIViewPropertyAnimator.m:3553) 19 UIKitCore 0x1a83e0e64 -[UIViewPropertyAnimator _setupAnimationTracking:] + 100 (UIViewPropertyAnimator.m:3510) 20 UIKitCore 0x1a83e1264 -[UIViewPropertyAnimator startAnimationAsPaused:] + 728 (UIViewPropertyAnimator.m:3610) 21 UIKitCore 0x1a83de42c -[UIViewPropertyAnimator pauseAnimation] + 68 (UIViewPropertyAnimator.m:2753) 22 UIKitCore 0x1a87d5328 -[UIPercentDrivenInteractiveTransition _startInterruptibleTransition:] + 244 (UIViewControllerTransitioning.m:982) 23 UIKitCore 0x1a87d5514 -[UIPercentDrivenInteractiveTransition startInteractiveTransition:] + 184 (UIViewControllerTransitioning.m:1012) 24 UIKitCore 0x1a7c7931c ___UIViewControllerTransitioningRunCustomTransitionWithRequest_block_invoke_3 + 152 (UIViewControllerTransitioning.m:1579) 25 UIKitCore 0x1a892aefc +[UIKeyboardSceneDelegate _pinInputViewsForKeyboardSceneDelegate:onBehalfOfResponder:duringBlock:] + 96 (UIKeyboardSceneDelegate.m:3518) 26 UIKitCore 0x1a7c79238 ___UIViewControllerTransitioningRunCustomTransitionWithRequest_block_invoke_2 + 236 (UIViewControllerTransitioning.m:1571) 27 UIKitCore 0x1a94ab4b8 +[UIView(Animation) _setAlongsideAnimations:toRunByEndOfBlock:animated:] + 188 (UIView.m:17089) 28 UIKitCore 0x1a7c79070 _UIViewControllerTransitioningRunCustomTransitionWithRequest + 556 (UIViewControllerTransitioning.m:1560) 29 UIKitCore 0x1a86cb7cc __77-[UIPresentationController runTransitionForCurrentStateAnimated:handoffData:]_block_invoke_3 + 1784 (UIPresentationController.m:1504) 30 UIKitCore 0x1a7c43888 -[_UIAfterCACommitBlock run] + 72 (_UIAfterCACommitQueue.m:137) 31 UIKitCore 0x1a7c437c0 -[_UIAfterCACommitQueue flush] + 168 (_UIAfterCACommitQueue.m:228) 32 UIKitCore 0x1a7c436d0 _runAfterCACommitDeferredBlocks + 260 (UIApplication.m:3297) 33 UIKitCore 0x1a7c43c34 _cleanUpAfterCAFlushAndRunDeferredBlocks + 80 (UIApplication.m:3275) 34 UIKitCore 0x1a7c1f104 _UIApplicationFlushCATransaction + 72 (UIApplication.m:3338) 35 UIKitCore 0x1a7c1f024 __setupUpdateSequence_block_invoke_2 + 352 (_UIUpdateScheduler.m:1634) 36 UIKitCore 0x1a7c2cee8 _UIUpdateSequenceRunNext + 128 (_UIUpdateSequence.mm:189) 37 UIKitCore 0x1a7c2c378 schedulerStepScheduledMainSectionContinue + 60 (_UIUpdateScheduler.m:1185) 38 UpdateCycle 0x28c58f5f8 UC::DriverCore::continueProcessing() + 84 (UCDriver.cc:288) 39 CoreFoundation 0x1a2323230 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 28 (CFRunLoop.c:2021) 40 CoreFoundation 0x1a23231a4 __CFRunLoopDoSource0 + 172 (CFRunLoop.c:2065) 41 CoreFoundation 0x1a2300c6c __CFRunLoopDoSources0 + 232 (CFRunLoop.c:2102) 42 CoreFoundation 0x1a22d68b0 __CFRunLoopRun + 820 (CFRunLoop.c:2983) 43 CoreFoundation 0x1a22d5c44 _CFRunLoopRunSpecificWithOptions + 532 (CFRunLoop.c:3462) 44 GraphicsServices 0x2416a2498 GSEventRunModal + 120 (GSEvent.c:2049) 45 UIKitCore 0x1a7c50ddc -[UIApplication _run] + 792 (UIApplication.m:3899) 46 UIKitCore 0x1a7bf5b0c UIApplicationMain + 336 (UIApplication.m:5574) // ...
4
1
465
5d
iOS 26 + UINavigationBar crash in layoutSubViews - new observation tracking
My #1 crash report since iOS 26 is the following: 1 libobjc.A.dylib objc_exception_throw 2 Foundation -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] 3 UIKitCore -[UINavigationBar layoutSubviews] 4 UIKitCore UIView._layoutSubviewsWithObservationTracking() 5 UIKitCore @objc UIView._layoutSubviewsWithObservationTracking() Thread 0 9 libobjc.A.dylib objc_exception_throw 10 Foundation -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] 11 UIKitCore -[UINavigationBar layoutSubviews] 12 UIKitCore UIView._layoutSubviewsWithObservationTracking() 13 UIKitCore @objc UIView._layoutSubviewsWithObservationTracking() I tried many things, without success so far. It seemed related to the new view update with observation tracking: link to documentation Any lead on how I should investigate this? Many thanks in advance!!
Topic: UI Frameworks SubTopic: UIKit Tags:
1
0
289
6d
CallKit automatically shows a system top toast after iOS 26, how to dismiss it?
I’m developing an iOS app that integrates with CallKit. Starting from iOS 26, I’ve noticed that the system automatically presents a top banner / toast-style UI when a CallKit call becomes active (see attached screenshot). This UI appears to be fully managed by the system. On iOS versions prior to iOS 26, this UI did not appear under the same CallKit configuration. What I’ve observed The banner is displayed automatically by the system It appears at the top of the screen, similar to a toast or call status banner It is not a view created by my app I could not find any public API or CallKit configuration related to dismissing or controlling it My questions: Is this top banner an intended system behavior change in newer iOS versions? Is there any public API to dismiss, hide, or customize this UI? If not, is this UI considered non-dismissible by design? Any clarification on the expected behavior or recommended approach would be greatly appreciated.
Topic: UI Frameworks SubTopic: UIKit Tags:
2
0
207
6d
Crash in swift::_getWitnessTable when passing UITraitBridgedEnvironmentKey
When using UITraitBridgedEnvironmentKey to pass a trait value to the swift environment, it causes a crash when trying to access the value from the environment. The issue seems to be related to how swift uses the UITraitBridgedEnvironmentKey protocol since the crash occurs in swift::_getWitnessTable () from lazy protocol witness table accessor…. It can occur when calling any function that is generic using the UITraitBridgedEnvironmentKey type. I originally encountered the issue when trying to use a UITraitBridgedEnvironmentKey in SwiftUI, but have been able to reproduce the issue with any function with a similar signature. https://developer.apple.com/documentation/swiftui/environmentvalues/subscript(_:)-9zku Steps to Reproduce Requirements for the issue to occur Project with a minimum iOS version of iOS 16 Build the project with Xcode 26 Run on iOS 18 Add the following code to a project and call foo(key: MyCustomTraitKey.self) from anywhere. @available(iOS 17.0, *) func foo<K>(key: K.Type) where K: UITraitBridgedEnvironmentKey { // Crashes before this is called } @available(iOS 17.0, *) public enum MyCustomTraitKey: UITraitBridgedEnvironmentKey { public static let defaultValue: Bool = false public static func read(from traitCollection: UITraitCollection) -> Bool { false } public static func write(to mutableTraits: inout UIMutableTraits, value: Bool) {} } // The crash will occur when calling this. It can be added to a project anywhere // The sample project calls it from scene(_:willConnectTo:options:) foo(key: MyCustomTraitKey.self) For example, I added it to the SceneDelegate in a UIKit Project class SceneDelegate: UIResponder, UIWindowSceneDelegate { var window: UIWindow? func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) { if #available(iOS 17, *) { // The following line of code can be placed anywhere in a project, `SceneDelegate` is just a convenient place to put it to reproduce the issue. foo(key: MyCustomTraitKey.self) // ^ CRASH: Thread 1: EXC_BAD_ACCESS (code=1, address=0x10) } } } Actual Behaviour The app crashes with the stack trace showing the place calling foo but before foo is actually called. (ie, a breakpoint or print in foo is never hit) #0 0x000000019595fbc4 in swift::_getWitnessTable () #1 0x0000000104954128 in lazy protocol witness table accessor for type MyCustomTraitKey and conformance MyCustomTraitKey () #2 0x0000000104953bc4 in SceneDelegate.scene(_:willConnectTo:options:) at .../SceneDelegate.swift:20 The app does not crash when run on iOS 17, or 26 or when the minimum ios version is raised to iOS 17 or higher. It also doesn't crash on iOS 16 since it's not calling foo since UITraitBridgedEnvironmentKey was added in iOS 17. Expected behaviour The app should not crash. It should call foo on iOS 17, 18, and 26.
0
0
29
6d
UIKit - Stop ongoing animation on the extended setVisibleMapRect Animation time on MapKit
Hi team, I've been trying to extend the animation when we call the function setVisibleMapRect, we can use UIView.animate to lengthen the animation time, but one thing that I found not working is that when I extend the animation to 3, 5, or 10 seconds, and the changes is still ongoing and there's a gesture performed, the map will completely ignore the gesture. Causing the map to be having this kind of like "delayed" or "freeze" experience for the user. The map will immediately move to the final rect and ignores the user gesture. I've been checking on this problem for a week now and I'm quite stuck. I've tried using CADisplayLink to manually animate the camera per system fresh rate, it works very well, I can stop the camera movement anytime there are touches, but it causes the resource CPU spikes. Removing the animation layers recursively on sublayers and subviews also doesn't help. While storing the animation into a UIViewPropertyAnimator and use stopAnimation will always ignores user first interactions too while also animating the camera to the final position (which is not expected).
4
0
229
6d
iOS 26.1 PHPickerConfiguration.preselectedAssetIdentifiers doesn't select previous pictures in the PHPickerViewController
Hi, I faced with the issue on iOS 26.1 with PHPickerViewController. After first selection I save assetIdentifier of PHPickerResult for images. next time I open the picker I expect to have the images selected based on assetIdentifier Code: var config = PHPickerConfiguration(photoLibrary: .shared()) config.selectionLimit = 10 config.filter = .images config.preselectedAssetIdentifiers = images.compactMap(\.assetID) let picker = PHPickerViewController(configuration: config) picker.delegate = self present(picker, animated: true) But on iOS 26.1 they aren't selected. On lower iOS version all works fine. Does anybody faced with similar issue?
Topic: UI Frameworks SubTopic: UIKit
5
4
410
1w
How to work with the "Tiếng Việt Telex" keyboard?
I have an iOS application that derives on UITextInput to enter text. I have also overridden pressesBegan() and pressesEnded() in order to have some extra keyboard management (auto-repeat, special actions for arrow keys, function keys...) That works well for single-character languages (most roman languages, such as English, French, etc). For multi-character languages (Chinese, Japanses, Korean, Hindi), I can detect that the keyboard has been set to that language, and switch back to the default version of pressesBegan(): if let keyboardLanguage = self.textInputMode?.primaryLanguage { if (keyboardLanguage.hasPrefix("hi") || keyboardLanguage.hasPrefix("zh") || keyboardLanguage.hasPrefix("ja") || keyboardLanguage.hasPrefix("ko")) { super.pressesBegan(presses, with: event) } } But that strategy fails with the Tiếng Việt Telex keyboard (for Vietnamese language input). The way that keyboard works (as you can see if you open a document in Pages) is that you type as you go: T-i-e-n-g V-i-e-t T-e-l-e-x and the system adds the relevant diacritics once you've finished a word, so typing "Tieng Viet Telex" gives you "Tiếng Việt Telex" on the screen. Is there any documentation on the inner workings of this specific keyboard? What should I do (or not do) in order to make my application compatible with Tiếng Việt Telex?
1
0
413
1w
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:
4
0
425
1w