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

Change anchor position of view for the tvOS focus engine
I'm developing a grid of focusable elements in SwiftUI with different sizes for tvOS (similar to a tv channel grid). Because the Focus Engine calculates the next view to focus based on the center of the currently focused view, sometimes it changes focus to an unexpected view. Here's an example: Actual: Expected: Is it possible to customize the anchor point from which the focus engine traces a ray to the next view? I would prefer the leading edge in my case.
0
0
399
Jan ’25
Trigger save of a FileDocument in a DocumentGroup?
I have a DocumentGroup working with a FileDocument, and that's fine. However, when someone creates a new document I want them to have to immediately save it. This is the behavior on ipadOS and iOS from what I can understand (you select where before the file is created). There seems to be no way to do this on macOS? I basically want to have someone: create a new document enter some basic data hit "create" which saves the file then lets the user start editing it (1), (2), and (4) are done and fairly trivial. (3) seems impossible, though...? This really only needs to support macOS but any pointers would be appreciated.
0
0
116
Apr ’25
Is MapKit.mapCameraKeyframeAnimator broken on macOS 15.2?
Hi! I'm attempting to run the Quakes Sample App^1 from macOS. I am running breakpoints and confirming the mapCameraKeyframeAnimator is being called: .mapCameraKeyframeAnimator(trigger: selectedId) { initialCamera in let start = initialCamera.centerCoordinate let end = quakes[selectedId]?.location.coordinate ?? start let travelDistance = start.distance(to: end) let duration = max(min(travelDistance / 30, 5), 1) let finalAltitude = travelDistance > 20 ? 3_000_000 : min(initialCamera.distance, 3_000_000) let middleAltitude = finalAltitude * max(min(travelDistance / 5, 1.5), 1) KeyframeTrack(\MapCamera.centerCoordinate) { CubicKeyframe(end, duration: duration) } KeyframeTrack(\MapCamera.distance) { CubicKeyframe(middleAltitude, duration: duration / 2) CubicKeyframe(finalAltitude, duration: duration / 2) } } But I don't actually see any map animations taking place when that selection changes. Running the application from iPhone simulator does show the animations. I am building from Xcode Version 16.2 and macOS 15.2. Are there known issues with this API on macOS?
0
0
292
Dec ’24
Live Activity resets to initial state after 8+ hours in background
Hi Apple team and community, We’re encountering a strange issue with Live Activity that seems related to memory management or background lifecycle. ❓ Issue: Our app updates a Live Activity regularly (every 3 minutes) using .update(...). However, after the app remains in the background for around 8 hours, the Live Activity reverts to the initial state that was passed into .request(...). Even though the app continues sending updates in the background, the UI on the Lock Screen and Dynamic Island resets to the original state.
0
0
56
Apr ’25
Opening recent files from Dock with MacCatalyst app
We are developing an MacOS app from our iOS app using MacCatalyst. If I press long on the app icon on the Dock, a list of recent files appears. If I tap one one of these files nothing happens. I would expect the scene delegate function: func scene(_ scene: UIScene, openURLContexts URLContexts: Set<UIOpenURLContext>) would be called but it is not. Can somebody maybe explain what I am missing here? The list of recent files also appears in the Menu under File > Open recent files. There I can tap on a file and it it is opened correctly using the scene delegate method mentioned above. The files can also be opened with the app using the Finder, so the associated file types with the app are correct.
0
0
305
Jan ’25
Uikit : -[UIApplication _terminateWithStatus:] + 136 (UIApplication.m:7539)
I have a few crash report from TestFlight with this context and nothing else. No symbols of my application. Crash report is attached. crashlog.crash It crashes at 16H25 (local time paris) and a few minutes after (8) I see the same user doing task in background (they download data with a particular URL in BGtasks) with a Delay that is consistant with a background wait of 5 or 7 minutes. I have no more information on this crash and by the way Xcode refuses to load it and shows an error. ( I did a report via Xcode for this).
0
0
61
Mar ’25
QuickLook Library updated text tampered on PDF
We were using below delegate methods from QuickLook to get modified PDF file URL after the sketching But we are not able see the multi line text properly laid out on PDF and part of text missing. Same time Other pencil kit tools are working as expected. `func previewController(_ controller: QLPreviewController, didSaveEditedCopyOf previewItem: QLPreviewItem, at modifiedContentsURL: URL) func previewController(_ controller: QLPreviewController, didUpdateContentsOf previewItem: any QLPreviewItem)` We tested all code in iOS 18.2. Please let us know if the text edited URL on PDF can be retrieved in any possible way without tampering text
0
0
376
Feb ’25
Custom slider png on gui
Im student, hobbyst on developing. i have a problem inserting a custom slidee PNG to control volume of an áudio file in an app. The slidee built in Swift, runs ok. When i try to use a custom png it show in the Gui but when move its button right it disappear beyond the maximum but when i move ir left the minimamente is at middle of the slider scale
Topic: UI Frameworks SubTopic: SwiftUI
0
0
39
Apr ’25
Correct way to run modal session?
My assumption has always been that [NSApp runModalForWindow:] runs a modal window in NSModalPanelRunLoopMode. However, while -[NSApplication _doModalLoop:peek:] seems to use NSModalPanelRunLoopMode when pulling out the next event to process via nextEventMatchingMask:untilDate:inMode:dequeue:, the current runloop doesn't seem to be running in that mode, so during -[NSApplication(NSEventRouting) sendEvent:] of the modal-specific event, NSRunLoop.currentRunLoop.currentMode returns kCFRunLoopDefaultMode. From what I can tell, this means that any event processing code that e.g. uses [NSTimer addTimer:forMode:] based on the current mode will register a timer that will not fire until the modal session ends. Is this a bug? Or if not, is the correct way to run a modal session something like this? [NSRunLoop.currentRunLoop performInModes:@[NSModalPanelRunLoopMode] block:^{ [NSApp runModalForWindow:window]; }]; [NSRunLoop.currentRunLoop limitDateForMode:NSModalPanelRunLoopMode]; Alternatively, if the mode of the runloop should stay the same, I've seen suggestions to run modal sessions like this: NSModalSession session = [NSApp beginModalSessionForWindow:theWindow]; for (;;) { if ([NSApp runModalSession:session] != NSModalResponseContinue) break; [NSRunLoop.currentRunLoop limitDateForMode:NSModalPanelRunLoopMode]; } [NSApp endModalSession:session]; Which would work around the fact that the timer/callbacks were scheduled in the "wrong" mode. But running NSModalPanelRunLoopMode during a modal session seems a bit scary. Won't that potentially break the modality?
0
0
83
Mar ’25
Stage Manager - UIWindowScene sizeRestrictions on iPad
Hello everyone, The setup: I have an iPadOS app. The app does not require full screen (Requires full screen option is disabled). The problem: The app starts looking unpolished when the canvas becomes too small. What I tried: I am trying to limit the canvas size for our app when run in Stage Manager. How: I saw that UIWindowScene has sizeRestrictions. This property is not always set as per documentation: https://developer.apple.com/documentation/uikit/uiwindowscene/sizerestrictions From my experiments, it only works when it's run on MacOS (in compatibility mode in our case). Console logs: Stage Manager - Requires full screen - OFF willConnectToSession - sizeRestrictions: nil sceneDidBecomeActive - sizeRestrictions: nil Stage Manager - Requires full screen - ON willConnectToSession - sizeRestrictions: nil sceneDidBecomeActive - sizeRestrictions: nil Stage Manager - Requires full screen - OFF - RUN on MacOS willConnectToSession - sizeRestrictions: Available sceneDidBecomeActive - sizeRestrictions: Available Question: Is there a way to enforce this minimum canvas size?
Topic: UI Frameworks SubTopic: UIKit
0
0
76
Mar ’25
How to make app for iPhone and iPad separatly
I released an app for iPhone (and it's could be downloaded for iPad also), and now I developered another app for iPad version with the same code and logic but I modified the layout to fit bigger screen and make better user experience and appearance. Howevert the app review rejected my release due to the duplicate content, how can I solve it?
Topic: UI Frameworks SubTopic: General
0
0
41
Mar ’25
SwiftUI: .searchable displays incorrectly in child views under NavigationStack
There appears to be a visual bug when using .searchable in a child view that’s pushed via NavigationLink inside a NavigationStack. Specifically, the search bar appears briefly in the wrong position (or animates in an unexpected way) during the transition to the child view. This issue does not occur when using NavigationView instead of NavigationStack. Steps to Reproduce: Create a TabView with a single tab containing a NavigationStack. Push from a ContentView to a DetailsView using NavigationLink. Add a .searchable modifier to both the ContentView and DetailsView. Run the app and tap a row to navigate to the details view. Expected Behavior The search bar in the DetailsView should appear smoothly and in the correct position as the view transitions in, just like it does under NavigationView. Actual Behavior When the DetailsView appears, the search bar briefly animates or appears in the wrong location before settling into place. This results in a jarring or buggy visual experience. Feedback: FB17031212 Here is a reddit thread discussing the issue as well https://www.reddit.com/r/SwiftUI/comments/137epji/navigation_stack_with_search_bar_has_a_bug_and_a/ I hope that an Apple engineer can get this fixed soon. It's frustrating to have new APIs come out with the old deprecated yet there are still obvious bugs two years later. import SwiftUI public enum Tab { case main } struct AppTabNavigation: View { @State private var tabSelection = Tab.main var body: some View { TabView(selection: $tabSelection) { NavigationStack { ContentView() } .tag(Tab.main) .tabItem { Label("Main", systemImage: "star") } } } } struct ContentView: View { @State private var searchText = "" var body: some View { List(0..<100) { i in NavigationLink("Select \(i)", value: i) } .navigationTitle("Main") .searchable(text: $searchText) .navigationDestination(for: Int.self) { i in DetailsView(i: i) } } } struct DetailsView: View { @State private var searchText = "" let i: Int // MARK: - Body var body: some View { List { ForEach(0..<10, id: \.self) { i in Text("Hello \(i)") } } .navigationTitle(i.formatted()) .searchable(text: $searchText) } }
Topic: UI Frameworks SubTopic: SwiftUI
0
0
69
Mar ’25
Do the coordinates obtained by scanning a QR code with VNDetectBarcodesRequest match the coordinates of the finder pattern?
I am creating an application that uses VNDetectBarcodesRequest to read QR codes from images and adjust the image orientation to match that of the QR code finder pattern. The QR code was successfully read, and the coordinates of the QR code were obtained.Upon checking the obtained topLeft, topRight, and bottomLeft coordinates, they always seem to match the topLeft, topRight, and bottomLeft coordinates of the finder pattern. Is it specified that the coordinates of topLeft, topRight, and bottomLeft obtained with VNDetectBarcodesRequest match the topLeft, topRight, and bottomLeft of the finder pattern? Or do they just happen to match? I would appreciate it if you could tell me if the matching of coordinates is a specification. Thank you for your help.
0
0
320
Feb ’25
Can't join current Group Activity on macOS (maybe some launch services thing?)
I'm testing using Group Activities and having no trouble iOS<->iOS or starting an activity on macOS and joining via iOS. However, when I start an activity and then try to join it from another macOS client, the starting side joins the session just fine, but the receiving side acts like I don't have the required app, even when it is already running. I see the active SharePlay icon in the menu bar, and the Current Activity is shown, but instead of an "Open" button there is a "MyApp Required" string and a "View" button that goes to the App Store. (Where the app is not available yet, as expected, since I'm still working on it.) There is no GroupSession started on that Mac yet, obviously. I'm looking for any hints to help debug what is going on. How does Group Activities find the app for the activity on macOS and how can I figure out why it isn't finding mine? Thanks!
0
0
328
Feb ’25
AppIntents - Choosing a default Measurement<UnitMass> for body weight based on locale
Here’s a clearer and more concise version of your question: I’m creating an AppIntent to allow users to log their body weight. My intent includes a @Parameter defined as: @Parameter( title: "Weight", description: "Current Weight", defaultUnit: .pounds, supportsNegativeNumbers: false ) var weight: Measurement<UnitMass> This works but doesn’t respect the user’s Locale and its measurementSystem. When I add defaultUnitAdjustForLocale: true to the @Parameter macro, the default always switches to kilograms, regardless of the locale. How can I correctly set the default unit to match the user’s locale for the purpose of entering a users body weight?
0
0
370
Jan ’25