Explore the various UI frameworks available for building app interfaces. Discuss the use cases for different frameworks, share best practices, and get help with specific framework-related questions.

All subtopics
Posts under UI Frameworks topic

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
78
May ’25
Why is UIViewController.dismissViewControllerAnimated marked as NS_SWIFT_DISABLE_ASYNC?
In the header for UIViewController, the method dismissViewControllerAnimated is declared like this: - (void)dismissViewControllerAnimated: (BOOL)flag completion: (void (^ __nullable)(void))completion NS_SWIFT_DISABLE_ASYNC API_AVAILABLE(ios(5.0)); NS_SWIFT_DISABLE_ASYNC means that there's no async version exposed like there would normally be of a method that exposes a completion handler. Why is this? And is it unwise / unsafe for me to make my own async version of it using a continuation? My use case is that I want a method that will sequentially dismiss all view controllers presented by a root view controller. So I could have this extension on UIViewController: extension UIViewController { func dismissAsync(animated: Bool) async { await withCheckedContinuation { continuation in self.dismiss(animated: animated) { continuation.resume() } } } func dismissPresentedViewControllers() async { while self.topPresentedViewController != self { await self.topPresentedViewController.dismissAsync(animated: true) } } var topPresentedViewController: UIViewController { var result = self while result.presentedViewController != nil { result = result.presentedViewController! } return result }
0
0
378
Feb ’25
ApplePay QR code popup language
Hi Team, when launching an ApplePay session from a 3rd party browser where we get the QR code popup - is it possible to affect the popup's language? We are setting the button's language via locale parameter, but when the QR code pop's up it does not respect this setting (seems like it respects browser language). Button in Arabic Corresponding popup Browser language Arabic Coresponding popup I was unable to find anything in the documentation - could you please either point me to the relevant documentation or confirm/deny that it is possible to request a language for the popup via tjr javascript API? Kind regards Tomas
0
0
107
May ’25
Food-Truck-Sample navigation broken from Live Activity?
https://github.com/apple/sample-food-truck Hi! I'm seeing what looks like some weird navigation issue in the Food Truck app. It's from the Live Activity that should deep link to a specific point in the app. There seems be some state where the app is not linking to the correct component. Here are my repro steps on iPhone: Start live activity from OrderDetailView. Navigate to Sidebar component. Tap the Live Activity. App opens TruckView. The App should be opening the OrderDetailView for the Order that was passed to the Live Activity. This seems to work when the app is not currently on Sidebar. Any ideas? I'm testing this on iPhone OS 18.4.1. Is this an issue inside NavigationSplitView? Is this an issue with how Food Truck handles deeplinking?
0
0
67
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
115
May ’25
Is it possible to automatically flip device orientation?
Hello togehter, i do have the following question. If I have my App run in landscape mode and a sheet view get's called, will it be possible to switch automatically from landscape mode in portrait mode and fix this device orientation? Once the sheet view get's dismissed or closed, the original view will come back and the device orientation shall switch back to landscape mode. Thanks you so much for your help!
0
0
249
Feb ’25
AppEntity with @Parameter Options Works in Shortcuts App but Not with Siri
I’m working with AppIntents and AppEntity to integrate my app’s data model into Shortcuts and Siri. In the example below, I define a custom FoodEntity and use it as a @Parameter in an AppIntent. I’m providing dynamic options for this parameter via an optionsProvider. In the Shortcuts app, everything works as expected: when the user runs the shortcut, they get a list of food options (from the dynamic provider) to select from. However, in Siri, the experience is different. Instead of showing the list of options, Siri asks the user to say the name of the food, and then tries to match it using EntityStringQuery. I originally assumed this might be a design decision to allow hands-free use with voice, but I found that if you use an AppEnum instead, Siri does present a tappable list of options. So now I’m wondering: why the difference? Is there a way to get the @Parameter with AppEntity + optionsProvider to show a tappable list in Siri like it does in Shortcuts or with an AppEnum? Any clarification on how EntityQuery.suggestedEntities() and DynamicOptionsProvider interact with Siri would be appreciated! struct CaloriesShortcuts: AppShortcutsProvider { static var appShortcuts: [AppShortcut] { AppShortcut( intent: AddCaloriesInteractive(), phrases: [ "Add to \(.applicationName)" ], shortTitle: "Calories", systemImageName: "fork" ) } } struct AddCaloriesInteractive: AppIntent { static var title: LocalizedStringResource = "Add to calories log" static var description = IntentDescription("Add Calories using Shortcuts.") static var openAppWhenRun: Bool = false static var parameterSummary: some ParameterSummary { Summary("Calorie Entry SUMMARY") } var displayRepresentation: DisplayRepresentation { DisplayRepresentation(stringLiteral:"Add to calorie log") } @Dependency private var persistenceManager: PersistenceManager @Parameter(title: LocalizedStringResource("Food"), optionsProvider: FoodEntityOptions()) var foodEntity: FoodEntity @MainActor func perform() async throws -> some IntentResult & ProvidesDialog { return .result(dialog: .init("Added \(foodEntity.name) to calorie log")) } } struct FoodEntity: AppEntity { static var defaultQuery = FoodEntityQuery() @Property var name: String @Property var calories: Int init(name: String, calories: Int) { self.name = name self.calories = calories } static var typeDisplayRepresentation: TypeDisplayRepresentation { TypeDisplayRepresentation(name: "Calorie Entry") } static var typeDisplayName: LocalizedStringResource = "Calorie Entry" var displayRepresentation: AppIntents.DisplayRepresentation { DisplayRepresentation(title: .init(stringLiteral: name), subtitle: "\(calories)") } var id: String { return name } } struct FoodEntityQuery: EntityQuery { func entities(for identifiers: [FoodEntity.ID]) async throws -> [FoodEntity] { var result = [FoodEntity]() for identifier in identifiers { if let entity = FoodDatabase.allEntities().first(where: { $0.id == identifier }) { result.append(entity) } } return result } func suggestedEntities() async throws -> [FoodEntity] { return FoodDatabase.allEntities() } } extension FoodEntityQuery: EntityStringQuery { func entities(matching string: String) async throws -> [FoodEntity] { return FoodDatabase.allEntities().filter({$0.name.localizedCaseInsensitiveCompare(string) == .orderedSame}) } } struct FoodEntityOptions: DynamicOptionsProvider { func results() async throws -> ItemCollection<FoodEntity> { ItemCollection { ItemSection("Section 1") { for entry in FoodDatabase.allEntities() { entry } } } } } struct FoodDatabase { // Fake data static func allEntities() -> [FoodEntity] { [ FoodEntity(name: "Orange", calories: 2), FoodEntity(name: "Banana", calories: 2) ] } }
0
1
97
May ’25
NearbyInteraction with Live Activity and background behavior on iOS 18.4 / watchOS – Questions on UWB and Audio
Hi everyone, we’d appreciate your input on the following use case – thanks in advance! In our iPhone and Apple Watch app, we’re using the NearbyInteraction API to measure the distance between both devices via UWB. Setup: On the iPhone, we start a LiveActivity together with the NISession, to keep the ranging active in the background. ✅ Good news: On iOS 18.4, this works as expected – the NISession stays active in the background as long as the Live Activity is running. Current issues: As soon as the Watch app moves to the background, ranging seems to pause and is eventually terminated. → Question 1: Is there a way to keep the NISession active on the Watch when the app goes into the background? Audio playback from background not working: We'd like to trigger audio playback when certain distance changes are detected. So far, we can only trigger haptic feedback in the background – audio does not play. → Question 2: Is it possible to play audio (e.g. using AVAudioPlayer) while a NISession and a LiveActivity are running in the background? We’d be grateful for any advice or best practices for this combination. Thanks and best regards!
Topic: UI Frameworks SubTopic: General
0
0
63
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
78
May ’25
How to create a QuickTime recording like panel?
QuickTime recording palette behaves in a way which I want to replicate in my desktop app - specifically the behaviour when switching spaces, it appears on top. Currently, my app appears on all spaces, and even over fullscreen applications BUT it already exists when I switch to the space, this feels disjointed. I can't find a solution to this behaviour. Here's the Window Collection Behaviours I've tried (on an NSPanel): FullScreenAuxiliary - appears over fullscreen apps. CanJoinAllSpaces - appears on all spaces. These two options make the dock show up on all spaces in the same position, but on each space they already exists. I've tried this behaviour too: MoveToActiveSpace - which as per docs would move the window into active space only when its reopened, mine stays open all the time. I can't find any more information on how QuickTime achieves this.
Topic: UI Frameworks SubTopic: SwiftUI
0
0
71
May ’25
How to customize item transitions inside a Picker View?
I have a simple Picker where the options available change by the view state. I would like to have the transition animated but the default animation is not good so I tried setting a .transition() and or an .animation() inside an item on the picker but it is ignored. The same happens if the transition is set on the picker itself since it's always present. Am I doing it right and is just not posible or is there something else to do? Code to reproduce the issue: struct ContentView: View { @State var list: [String] = [ "Item 4", "Item 5", "Item 6", "Item 7", "Item 8", ] @State var selected: String? @State var toggle: Bool = false var body: some View { VStack { Picker("List", selection: $selected) { ForEach(list, id: \.self) { Text($0).tag($0) // .transition(.opacity) } } .pickerStyle(.segmented) // .transition(.opacity) HStack { Button(action: swapOptions) { Text("Swap") } } } .padding() } } extension ContentView { func swapOptions() { withAnimation { toggle.toggle() switch toggle { case true: list = [ "Item 1", "Item 2", "Item 3", "Item 4", "Item 5", ] case false: list = [ "Item 4", "Item 5", "Item 6", "Item 7", "Item 8", ] } } } } ``
Topic: UI Frameworks SubTopic: SwiftUI
0
0
88
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
64
May ’25
iOS 17 Bug? Adding a .sheet to a .fullscreencover makes background opaque
I am working on creating a custom Popup View based on a .fullscreenCover. The .fullscreenCover is used to place the Popup content on screen on a semi-transparent background. While this works on iOS 18, there is a problem on iOS 17: When the Popup content contains a .sheet, the background is not transparent any more but opaque. Image: iOS 17. When showing the Popup an opaque background covers the main content. When tapping on the background it turns transparent. Image: iOS 18. Everything works as intended. When showing the Popup the main background is covered with a semi-transparent background. Removing the .sheet(...) from the Popup content solves the problem. It does not matter if the sheet is used or not. Adding it to the view code is enough to trigger the problem. Using a .sheet within a .fullscreenCover should not be a problem as far as I know. Is this a bug in iOS 17 or is there something wrong with my code? Code: struct SwiftUIView: View { @State var isPresented: Bool = false @State var sheetPresented: Bool = false var body: some View { ZStack { VStack { Color.red.frame(maxHeight: .infinity) Color.green.frame(maxHeight: .infinity) Color.yellow.frame(maxHeight: .infinity) Color.blue.frame(maxHeight: .infinity) } Button("Show") { isPresented = true } .padding() .background(.white) Popup(isPresented: $isPresented) { VStack { Button("Dismiss") { isPresented = false } } .frame(maxWidth: 300) .padding() .background( RoundedRectangle(cornerRadius: 20) .fill(.white) ) .sheet(isPresented: $sheetPresented) { Text("Hallo") } } } } } struct Popup<Content: View>: View { @Binding var isPresented: Bool let content: () -> Content init(isPresented: Binding<Bool>, @ViewBuilder _ content: @escaping () -> Content) { _isPresented = isPresented self.content = content } @State private var internalIsPresented: Bool = false @State private var isShowing: Bool = false let transitionDuration: TimeInterval = 0.5 var body: some View { ZStack { } .fullScreenCover(isPresented: $internalIsPresented) { VStack { content() } .frame(maxWidth: .infinity, maxHeight: .infinity) .background( Color.black.opacity(0.5) .opacity(isShowing ? 1 : 0) .animation(.easeOut(duration: transitionDuration), value: isShowing) .ignoresSafeArea() ) .presentationBackground(.clear) .onAppear { isShowing = true } .onDisappear { isShowing = false } } .onChange(of: isPresented) { _ in withoutAnimation { internalIsPresented = isPresented } } } } extension View { func withoutAnimation(action: @escaping () -> Void) { var transaction = Transaction() transaction.disablesAnimations = true withTransaction(transaction) { action() } } }
Topic: UI Frameworks SubTopic: SwiftUI
0
0
96
May ’25
memory leak upon mouse down in a NSTextField
Dear all, Sorry if the topic has already been commented but I could not be able to find it in over 10,000 picks using the forum search field... My problem is that with any NSTextField in my app, a click will result in a memory leak. There is no code attached, just bindings to NSNumber properties. How can I fix this ? Thanks for your help. Best regards Chris
Topic: UI Frameworks SubTopic: AppKit
0
0
69
May ’25
[SwiftUI] Gesture Conflict: simultaneousGesture Causes Incorrect Gesture Recognition in iOS 18
Subject: SwiftUI Gesture Conflict in iOS 18: Simultaneous Recognition of Drag and Tap Gestures Description: In SwiftUI on iOS 18 and above, we've identified an issue with gesture handling that affects user experience. When implementing .simultaneousGesture(DragGesture()), the system incorrectly recognizes and processes both drag and tap gestures concurrently, resulting in unintended behavior. Technical Details: Environment: SwiftUI, iOS 18+ Issue: Simultaneous recognition of horizontal drag gestures and vertical scroll/tap gestures Current Behavior: Both vertical and horizontal scrolling occur simultaneously when using .simultaneousGesture(DragGesture()) Expected Behavior: Gestures should be properly disambiguated to prevent concurrent scrolling in multiple directions Impact: This behavior significantly impacts user experience, particularly in custom carousel implementations and other UI components that rely on precise gesture handling. The simultaneous recognition of both gestures creates a confusing and unpredictable interaction pattern. Steps to Reproduce: Create a SwiftUI view with horizontal scrolling (e.g., custom carousel) Implement .simultaneousGesture(DragGesture()) Add tap gesture recognition to child views Run on iOS 18 Attempt to scroll horizontally Observed Result: Both horizontal dragging and vertical scrolling/tapping are recognized and processed simultaneously, creating an inconsistent user experience. Expected Result: The system should properly disambiguate between horizontal drag gestures and vertical scroll/tap gestures, allowing only one type of gesture to be recognized at a time based on the user's intent. Please let me know if you need any additional information or reproduction steps.
0
0
116
Apr ’25
[SwiftUI] SecureEntry Autofill in Dark Mode
When using New Password Autofill in Dark Mode, it appears that SecureEntry sets the background color to white and applies a yellow-ish overlay, but doesn't adapt the foreground text color accordingly. This gives the illusion that the SecureEntry field is empty, as we have white text on a white background. Is there a holistic and SwiftUI-native way of fixing this?
0
0
55
Apr ’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
94
Apr ’25