Thanks for being a part of WWDC25!

How did we do? We’d love to know your thoughts on this year’s conference. Take the survey here

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

How to Use AccessorySetupKit to Automatically Trigger Hardware Pairing Screen in the Background?
Hello everyone, I’m currently developing an iOS app and would like to leverage the AccessorySetupKit framework introduced in iOS 18 to implement pairing functionality with our company's custom hardware product. The specific requirements are as follows: Our hardware supports both Bluetooth and Wi-Fi connections, and both are enabled. When the hardware device is in proximity to an iPhone, I want the device to be automatically recognized, and a pairing screen similar to the one in AccessorySetupKit should appear. Users should be able to perform the pairing process without needing to open our app, even if the app is not in the foreground. The system-level pairing screen should show the hardware information and allow the user to proceed with the pairing. My questions are: Does AccessorySetupKit allow the pairing screen to trigger when the app is running in the background, or must the app be in the foreground? How should I configure AccessorySetupKit to automatically recognize and display my company’s hardware device information? Are there any specific configurations or code implementations needed? Do I need to implement any specific Bluetooth/Wi-Fi advertising broadcasts to ensure the device is correctly detected by the iOS system when in proximity? Are there any additional permissions or configurations required, especially for handling background tasks? Thank you very much for your help, and I look forward to your advice and insights!
Topic: UI Frameworks SubTopic: UIKit
0
0
25
May ’25
ScreenBlur is not happening always when app goes to app switcher.
We have written code to blur the app screen in "applicationWillResignActive" when app goes to app switcher. But the blur affect is observed only some times. Is there is any specific reason for this? We have a doubt that applicationWillResignActive is not always completely executed or is dismissed by OS for other priority activities. Is this is expected behaviour or are we missing anything here?
Topic: UI Frameworks SubTopic: UIKit
13
0
112
May ’25
How to prevent iOS VoiceOver from speaking accessibility-labels and traits?
I have a button with the following properties: accessibilityLabel: "Action Button", traits: "Button", accessibilityHint: "Performs the main action". The voiceover reads the button as follows: Action Button, Button, Performs the main action. I want to understand how to configure it to only speak the accessibilityHint or only the accessibilityLabel and never speak the traits. In another example, a switch has the traits: Button, and Toggle. So these traits are a part of what the voiceover speaks. I want only the accessibilityLabel or accessibilityHint to be spoken in this case. Please let me know how. Thanks
1
0
44
May ’25
Tab bar inline icon text .compact mode in size classes in iPad in iOS 18..4.1
I am trying to do inline to icon and text in tab bar but it is not allowing me to do it in compact, but it showing me in regular mode , but in regular mode tab bar going at top in portrait mode , But my requirement is tab bar required in bottom with icon and text in inline it showed by horizontally but it showing to me stacked vertically, will you guide me on this so that I can push the build to live users.
0
0
46
May ’25
macOS Sequoia/Xcode 16.2 - Catalyst App Missing Tab Bar
My Objective-C Catalyst app when built with Xcode 16.x/iOS 18 does not have a visible Tab Bar when run on Sequoia. App starts up in first tab, but there is no way to access other tabs. The same app when run on macOS Sonoma (or macOS Catalina) has a normal Tab Bar. The app has an initial View UITabBarController with 3 tabs. The main tab is a UiSplitViewController. Minimum macOS deployment 10.5. If app is built on Sonoma with Xcode 15.x/iOS 17 the Tab Bar is normal on macOS Sonoma, Sequoia, and Catalina. I've tried without success: if (@available(macCatalyst 18.0, *)) { self.tabBarController.tabBarHidden = false; } else { // Fallback on earlier versions } I wonder if this console log message has anything to do with the problem: CLIENT OF UIKIT REQUIRES UPDATE: This process does not adopt UIScene lifecycle. This will become an assert in a future version.
2
0
88
May ’25
iOS 18.4.1 Keyboard Extension Dark Mode Background Issue
Background Color Issue in Custom Keyboard Extension in Dark Mode for iOS 18.4.1 Issue Description I'm developing a custom keyboard extension for iOS 18.4.1 and experiencing an issue with background colors when using Dark Mode. After a user makes a selection from a menu in the keyboard, the background color of a view unexpectedly changes to white instead of maintaining the dark theme color. Steps to Reproduce Enable Dark Mode on the device Activate the custom keyboard in any text field Perform a specific interaction (selecting an item from a menu) After selection, the background of the view turns white instead of remaining dark Technical Details The issue appears to be related to UIScrollView's background color behavior The problem doesn't occur on initial display of the menu, only after user interaction I've attempted to set background colors explicitly on the view hierarchy, but the issue persists Environment iOS 18.4.1 Xcode 16.0 Custom keyboard extension Questions Has anyone encountered similar issues with view background colors changing after user interactions in keyboard extensions on iOS 18.4.1? Is there a recommended approach to maintain dark background colors in keyboard extensions after user selections? Could this be related to a change in how UIScrollView handles background colors in recent iOS versions? Thank you for any assistance or insights.
Topic: UI Frameworks SubTopic: UIKit
0
0
41
May ’25
How do I size a UITextView with scroll disabled?
tl;dr: UITextView does not auto layout when isScrollEnabled = false I have a screen with multiple UITextViews on it, contained within a ScrollView. For each textview, I calculate the height needed to display the entire content in SwiftUI and set it using the .frame(width:height:) modifier. The UITextView will respect the size passed in and layout within the container, but since UITextView is embedded within a UIScrollView, when a user attempts to scroll on the page, often they will scroll within a UITextView block rather than the page. They currently need to scroll along the margins outside of the textview to get the proper behavior. Since I am already calculating the height to display the text, I don't want the UITextView to scroll. However, when I set isScrollEnabled = false, the text view displays in a single long line that gets truncated. I have tried Setting various frame/size attributes but that seems to have zero affect on the layout. Embedding the textView within a UIView, and then sizing the container, but then the textView does not display at all. Setting a fixed size textContainer in the layoutManager but did not work. There's a lot of code so I can't copy/paste it all, but generally, it looks like struct SwiftUITextEditor: View { @State var text: AttributedString = "" var body: some View { ZStack { MyTextViewRepresentable(text: $text) } .dynamicallySized(from: $text) } } struct MyTextViewRepresentable: UIViewRepresentable { @Binding var text: AttributedString let textView = UITextView(usingTextLayoutManager: true) func makeUIView(context: Context) -> UITextView { textView.attributedText = text textView.isScrollEnabled = false } ... }
1
0
55
May ’25
When presenting CPNavigationAlert the navigation bar will appear
In my CarPlay app, I am hiding the navigation bar by using the following: self.mapTemplate?.automaticallyHidesNavigationBar = true self.mapTemplate?.hidesButtonsWithNavigationBar = false I don't want the navigation bar to show unless a user interacts with the map by tapping it. Strangely, when I present a CPNavigationAlert the navigation bar will often appear and then disappear after the alert is dismissed. Is there a setting or reason that the navigation bar would be appearing when presenting this alert? I would like to keep the nav bar hidden during this time.
Topic: UI Frameworks SubTopic: UIKit Tags:
0
0
33
May ’25
cannot save event
iOS 18.4.1 When I change a Google type event to an iCloud type, a "Cannot Save Event" prompt box pops up. We have also received user feedback that recurring events also fail to save. After updating to iOS 18.4 when trying to save changes to an existing repeating event, the message "Cannot Save Event" will appear. EventKitUI
Topic: UI Frameworks SubTopic: UIKit
0
0
39
May ’25
Specific ARKit node not showing in AR
After two types of objects correctly inserted as nodes in an augmented reality setting, I replicated exactly the same procedure with a third kind of objects that unfortunately refuse to show up. I checked the flow and it is the same as the other objects as well the content of the LocationAnnotation, but there is surely something that escapes me. Could someone help with some ideas? This is the common code, apart of the class: func appendInAR(ghostElement: Ghost){ let ghostElementAnnotationLocation=GhostLocationAnnotationNode(ghost: ghostElement) ghostElementAnnotationLocation.scaleRelativeToDistance = true sceneLocationView.addLocationNodeWithConfirmedLocation(locationNode: ghostElementAnnotationLocation) shownGhostsAnnotations.append(ghostElementAnnotationLocation) }
9
0
80
May ’25
Behavior of Drawings in Portrait/Landscape Mode
The app provides a simple drawing functionality on a canvas without using a storyboard. After creating drawings in portrait mode, rotating the simulator or the iPad-Device to landscape mode does not update or rescale the existing drawings to fit the newly expanded canvas area. The app can also be launched directly in landscape mode, allowing drawings to be created before rotating the device back to portrait mode. However, the issue persists, with the drawings not adjusting to the new canvas dimensions. The goal is to achieve the same behavior as in the Apple Notes app: when the iPad is rotated, the drawings should adjust to the newly expanded or reduced canvas area. I would appreciate any suggestions or solutions. Sample Projekt [https://github.com/GG88IOS/Test_Drawing_App)
4
0
75
May ’25
Intents UI Extension automatically dismisses
I am working on implementing a new Intents UI Extension and have noticed that when it is triggered via the "Hey Siri" voice command, the intent dismisses after a few seconds. However, if it is launched from the Shortcuts app, the intent remains active and does not dismiss automatically. Additionally, I’ve observed that this behavior occurs on specific iOS versions, such as 17.5.1 or 17.7. On other versions, like 17.4.1 or 18.4, the intent persists as expected. Does Siri automatically close the intent based on its own logic? Could the iOS version be influencing this behavior? Given the requirement to make the intent persistent, is there any option or configuration available to achieve this?
0
0
31
Apr ’25
Random crash on app language change from app
I've developed an app in swift and UIKit. Its multi linguistic app supports English and Arabic. When I change the language from English to Arabic or Arabic to English. After changing language, when I navigate through different screens crash is happening randomly on different screens most of the time when I tap to navigate to a screen. And cash log is: This time crashed with this error Exception NSException * "Not possible to remove variable:\t945: <unknown var (bug!) with engine as delegate:0x2824edf00>{id: 34210} colIndex:261 from engine <NSISEngine: 0x15c5dd5f0>{ delegate:0x15c594b50\nEngineVars:\n\t 0: objective{id: 31542} rowIndex:0\n\t 1: UIButton:0x15c6255b0.Width{id: 31545} rowIndex:1\n\t 2: 0x281c41450.marker{id: 31548} colIndex:1\n\t 3: UIButton:0x15c6255b0.Height{id: 31547} rowIndex:1073741824\n\t 4: 0x281c412c0.marker{id: 31546} colIndex:1073741825\n\t 5: UIButton:0x15c625a50.Width{id: 31549} rowIndex:11\n\t 6: 0x281c41270.marker{id: 31544} colIndex:2\n\t 7: UIButton:0x15c625a50.Height{id: 31551} rowIndex:1073741825\n\t 8: 0x281c414a0.marker{id: 31550} colIndex:1073741826\n\t 9: UILabel:0x15c625d10.Height{id: 31553} rowIndex:1073741826\n\t 10: 0x281c41590.marker{id: 31552} colIndex:1073741827\n\t 11: UIImageView:0x15c625870.Width{id: 31555} rowIndex:3\n\t 12: 0x281c41360.marker{id: 31554} colIndex:3\n\t 13: UIImageView:0x15c625870.Height{id: 31557} rowIndex:1073741827\n\t 14: 0x281c413b0.marker{id: 31556} colIndex:1073741828"... 0x0000000282fb11a0 For switching language I'm using this code snippet: private func restartApp() { guard let windowScene = UIApplication.shared.connectedScenes.first as? UIWindowScene, let delegate = windowScene.delegate as? SceneDelegate, let window = delegate.window else { return } // Create a new root view controller let vc : AppLoadingVC = AppRouter.instantiateViewController(storyboard: .Splash) let nc = UINavigationController(rootViewController: vc) ApplicationManager.sharedInstance.isUserLoggedIn = false DispatchQueue.main.async { if UserDefaults.isRTL { UIView.appearance().semanticContentAttribute = .forceRightToLeft SideMenuController.preferences.basic.forceRightToLeft = true Localize.setCurrentLanguage("ar") } else { UIView.appearance().semanticContentAttribute = .forceLeftToRight SideMenuController.preferences.basic.forceRightToLeft = false Localize.setCurrentLanguage("en") } window.rootViewController = nc window.makeKeyAndVisible() } } Please anybody help me I've been stuck here since lot of days. I tried multiple things but all in vain.
1
0
41
Apr ’25
App Crashes on Paper Selection After Background Printer Connection
Description: 1. When initiating the print flow via UIPrintInteractionController, and no printer is initially connected, iOS displays all possible paper sizes in the paper selection UI. However, if a printer connects in the background after this view is shown, the list of paper sizes does not automatically refresh to reflect only the options supported by the connected printer. 2. If the user selects an incompatible paper size (one not supported by the printer that has just connected), the app crashes due to an invalid configuration. Steps to Reproduce: Launch the app and navigate to the print functionality. Tap the Print button to invoke UIPrintInteractionController. At this point, no printer is yet connected. iOS displays all available paper sizes. While the paper selection UI is visible, the AirPrint-compatible printer connects in the background. Without dismissing the controller, the user selects a paper size (e.g., one that is not supported by the printer). The app crashes. Expected Result: App should not crash Once the printer becomes available (connected in the background), the paper size options should refresh automatically. The list should be filtered to only include sizes that are compatible with the connected printer. This prevents the user from selecting an invalid option, avoiding crashes. Actual Result: App crashes The paper size list remains unfiltered. The user can still select unsupported paper sizes. Selecting an incompatible option causes the app to crash, due to a mismatch between UI selection and printer capability. Demo App Crash : https://drive.google.com/file/d/19PV02wzOJhc2DYI6kAe-uxHuR1Qg15Bu/view?usp=sharing Apple Files App Crash: https://drive.google.com/file/d/1flHKuU_xaxHSzRun1dYlh8w7nBPJZeRb/view?usp=sharing
0
0
17
Apr ’25
Use Siri to control parts of my CarPlay app
I am building a CarPlay navigation app and I would like it to be as hands free as possible. I need a better understanding of how Siri can work with CarPlay and if the direction I need to go is using Intents or App Shortcuts. My goal is to be able to have the user speak to Siri and do things like "open settings" or "zoom in map" and then call a func in my app to do what the user is asking. Does CarPlay support this? Do I need to use App Intents or App Shortcuts or something else?
2
0
57
Apr ’25