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

UI Bug in Family Sharing
System Settings is recommending I review the settings for my two children. The UI has a bug where it always opens the top most child even if I select the bottom of the two. Was present in 15.1.1 and is still present after installing 15.2
Topic: UI Frameworks SubTopic: General
1
0
266
Dec ’24
IKSaveOptions Only Calls its Delegate Once
I use IKSaveOptions to add an accessory view to an NSSavePanel to give the user choice of the image file type (etc) used to save a file. I limit the available file type choices in the accessory's menu by specifying a delegate object that offers the saveOptions:shouldShowUTType: method. Historically, my delegate was called repeatedly (for many file types) so, for those not supported by my code, I was able to omit them from the menu. This is expected behaviour from my interpretation of the documentation for saveOptions:shouldShowUTType: As of Ventura 13.1, the delegate was not called at all; instead, the entire (or at least a long) list of options was offered in the panel. Running the same build of my code on Catalina 10.15.7 still had the historical behaviour. In Sonoma (14.0) the delegate was called exactly once (for JPEG). This behaviour persists in Sequoia 15.1.1 . I have used test code and breakpoints to ensure that I pass a valid reference to my delegate and to inspect when (if) it is called. If there is some (new?) pre-condition for the accessory's use needed on Ventura and later, or a workaround, I would be grateful to be pointed to it.
Topic: UI Frameworks SubTopic: AppKit
0
0
330
Dec ’24
SwiftData iCloud sync breaks after disabling and re-enabling iCloud
A fairly simple ModelContainer: var sharedModelContainer: ModelContainer = { let schema = Schema([ Model1.self, Model2.self, Model3.self ]) let modelConfiguration = ModelConfiguration(schema: schema, isStoredInMemoryOnly: false, cloudKitDatabase: .automatic) do { let container = try ModelContainer(for: schema, migrationPlan: MigrationPlan.self, configurations: [modelConfiguration]) return container } catch { fatalError("Error: Could not create ModelContainer: \(error)") } }() After upgrading to macOS 15 and disabling/enabling iCloud for the app the sync stopped working on Mac. The steps: Go to System Settings > Apple Account > iCloud > Saved to iCloud > See all find the App and disable iCloud. After this synced items are removed from the app and some errors thrown in the console ('..unable to initialize without an iCloud account...') Re-enable the iCloud setting This error appears in the console: CoreData: error: CoreData+CloudKit: -[NSCloudKitMirroringDelegate resetAfterError:andKeepContainer:](612): <NSCloudKitMirroringDelegate: 0x6000020dc1e0> - resetting internal state after error: Error Domain=NSCocoaErrorDomain Code=134415 "(null)" On macOS Sonoma the items are synced back to the app and the sync is restored, but on Sequoia they don't come back and the sync is not working. I tried resetting the container, deleting all data - no help. Submitted FB15455847
12
0
2k
Dec ’24
Suppressing contextual menu on AVPlayerView in SwiftUI app
My app plays videos. At first I used SwiftUI’s VideoPlayer, but that didn't give me enough control over the underlying AVPlayerView, so I created my own NSViewRepresentable. That works well, and I can adjust the AVPlayerView as I see fit. But it seems to have a contextual menu that still appears instead of the one I try to apply using SwiftUI. If I put a non-opaque color over the AVPlayerView in a ZStack, I'm able to then add a .contextMenu that works, but only if the color is non-opaque (e.g. Color(red: 0, green: 0, blue: 0, opacity: 0.00001)). This feels like a pretty hacky solution, and doesn’t work if I set opacity: to 0. Is there a better way to keep AVPlayerView from handling events? It also gets scroll events (which scrubs through the movie) that I'd like to suppress.
Topic: UI Frameworks SubTopic: SwiftUI
0
0
258
Dec ’24
.symbolRenderingMode(.multicolor) generates warning
Hi, I recently updated my app to swift 6, ios 18, xcode 16. I now have always a warning like "CoreSVG has logged an error. Set environment variabe "CORESVG_VERBOSE" to learn more." if I use an SF image with a multicolor renderingmode. I have this on labels, image, ... If I change the rendering to palette or something else the warning is gone. For the rest, the multicolor rendering is fine because the result is ok. Can this warning be solved? PS: This happens on device and simulator
2
2
837
Dec ’24
Mac: TabView sidebar style does not select Tabs from label or image, only whitespace
On MacOS when TabView is in sidebarAdaptable mode: Clicking the Tab directly on the text of its label, or its systemImage, does not actually select the Tab. The only way to select the Tab is to click whitespace around the text, for example to the right side of the text. iOS has behavior better – you can click the text or image to select the Tab. This behavior is really bizarre and not user-friendly. I'm surprised it could even ship like this. Tabs are actually unusable in sidebarAdaptable because users should not have to be explained to that they need to click on whitespace. Am I missing something? Seems almost too strange to be a bug.
Topic: UI Frameworks SubTopic: SwiftUI
0
0
173
Dec ’24
Nested TimelineView and List cause hang issue
Hello. I’ve encountered a strange issue with TimelineView and wanted to report it. The following code runs without any problems: // Example 1. struct ContentView: View { var body: some View { TimelineView(.everyMinute) { _ in List { TimelineView(.everyMinute) { _ in Text("Hello") } } } } } However, the code below causes the CPU usage to spike to 100%, and the screen displays a blank view: // Example 2. struct ContentView: View { var body: some View { TimelineView(.everyMinute) { _ in List { TimelineView(.everyMinute) { _ in text } } } } var text: some View { Text("Hello") } } The same issue occurs with the following code: // Example 3. struct MyTextView: View { var body: some View { Text("Hello") } } struct ContentView: View { var body: some View { TimelineView(.everyMinute) { _ in List { TimelineView(.everyMinute) { _ in MyTextView() } } } } } Replacing List with LazyVStack and ForEach resolves the hang issue, but I need to use List because I rely on the swipeActions(). Does anyone have insights or suggestions on how to address this issue?
1
0
262
Dec ’24
iOS18.childViewController lifecycle of UITabbarController does not execute
I have encountered a tricky problem and hope to receive help. My APP process does not exist, and then I click on the notification message of the APP to open it. At this time, my APP will first configure uitabbarccontroller, and then push the first (index=0) viewcontroller (A) from the tab to the notification message list viewcontroller (B). However, I found that on iOS18, the lifecycle of A (viewDidLoad) did not execute at the end of this process. I am sure this problem will occur stably on iOS18.1.1. Versions lower than iOS18 will not. Can someone tell me why this is?
0
0
406
Dec ’24
tableView works properly in older iphones, but fails in newer ones
I have an ios application where I have a tab and a container view. Container view changes according to the tab I have selected. Issue I am facing is that that my table view shows all cells properly in older iphones(iphone with home button), while in newer iphones(iphone with home bar), table view doesn't scroll till the end and hides bottom cell. I have tried adding all necessary constraints and content insets, but still it is giving me same issue I have different class for tabBar, tabBar+containerView, and all related view controllers based on tab selected. Please help me find the solution to this. Thanks
0
0
341
Dec ’24
UISearchController is hidden initially until I scroll down.
I have been implementing a UISearchController, I add it to the navigationItem of the view. When the view loads, it is hidden until I scroll down to show it. I want it to be shown initially. I have changed the navigationItem.hidesSearchBarWhenScrolling to false, it solved the initial problem but I also want it to be hidden when the user is scrolling through the collectionView of the view. I am currently using Swift 6 and iOS 18+. I will add the current configuration function. private func configureSearchController() { let searchController = UISearchController() searchController.searchResultsUpdater = self searchController.searchBar.delegate = self searchController.searchBar.placeholder = "Search for a username" searchController.obscuresBackgroundDuringPresentation = false navigationItem.searchController = searchController navigationItem.hidesSearchBarWhenScrolling = false }
Topic: UI Frameworks SubTopic: UIKit Tags:
1
0
401
Dec ’24
SwiftUI Transition System is confusing...
Hi everyone, I’m having trouble getting the correct horizontal slide transitions when navigating between multiple screens in my SwiftUI app. I have three screens (enum cases with an int assigned as index depending on the navigation order): .checkClient (index 0), .login(document: String) (index 1), and .register (index 2). My goal is: When moving forward (e.g., from .checkClient to .login, or from .login to any other with a greater index), the new screen should enter from the right (trailing) and the old one should exit to the left (leading). When going backward (from .register back to .checkClient, for example), the new screen should enter from the left (leading) and the old one should exit to the right (trailing). I’ve been using a state property isAdvancing to determine the direction of transitions (I use TCA, so my logic is in a Reducer body, my properties in a State and my views are normal SwiftUI Views): case .updateCurrentScreen(let newScreen): state.isAdvancing = newScreen.index > state.currentScreen.index state.currentScreen = newScreen return .none I tried applying .transition directly inside each case: .transition( .asymmetric( insertion: .move(edge: store.isAdvancing ? .trailing : .leading), removal: .move(edge: store.isAdvancing ? .leading : .trailing) ) ) This works correctly the first time I navigate forward. However, when I go to the .register screen and then hit back, the directions become inconsistent. Sometimes the removal happens in the wrong direction, and after returning to .checkClient, forward navigations stop working as intended. Then, I tried placing the transition at a higher level, wrapping the switch in a ZStack and using a single .transition(...) outside: ZStack { switch store.currentScreen { case .checkClient: StartView(...) case .login: LoginView(...) case .register: RegisterView(...) } } .transition( .asymmetric( insertion: .move(edge: store.isAdvancing ? .trailing : .leading), removal: .move(edge: store.isAdvancing ? .leading : .trailing) ) ) .animation(.easeInOut, value: store.currentScreen) But doing this results in some transitions reverting to a fade instead of a horizontal slide. I’ve also tried ensuring that isAdvancing updates before changing the currentScreen. Unfortunately, I still encounter inconsistent transitions when navigating back and forth between these screens. Here is my complete view logic (even though is not finished nor polished yet): var body: some View { WithPerceptionTracking { ZStack { AdaptiveSheetView( backgroundImage: Asset.AuthorizationDomain.background, hasBackButton: store.showsBackButton, isFullScreen: store.isFullScreen, backAction: { store.send(.goBack) } ) { if store.showsIATILogo { Image(asset: Asset.iatiLogo) .padding(spacing: .medium) } ZStack { switch store.currentScreen { case .checkClient: StartView(store: store.scope(state: \.startState, action: \.startAction)) case .login: if let newStore = store.scope(state: \.loginState, action: \.loginAction) { LoginView(store: newStore) } case .register: if let newStore = store.scope(state: \.registerState, action: \.registerAction) { RegisterView(store: newStore) } } } .transition( .asymmetric( insertion: .move(edge: store.isAdvancing ? .trailing : .leading), removal: .move(edge: store.isAdvancing ? .leading : .trailing) ) ) } .animation(.easeInOut, value: store.currentScreen) if store.startState.checkUser == .loading { LoadingSpinner() } PreloadView(store: store.scope(state: \.preloadState, action: \.preloadAction)) .opacity(store.preloadViewShown ? 1.0 : 0.0) .animation(.linear(duration: 0.5), value: store.preloadViewShown) .onChange(of: store.preloadViewShown) { shown in if !shown { store.send(._checkPreviousSessions) } } } } } Has anyone experienced similar issues or found a reliable pattern for achieving these “push/pop” style transitions in SwiftUI? Any guidance would be greatly appreciated! My minimum target is iOS 16, so I can not make use of TabView with paginated style for this AFAIK. Thanks in advance for any time and attention you dedicate to me 🙏🏼
1
0
417
Dec ’24
Issue with willResignActiveNotification and didBecomeActiveNotification Not Triggering on Siri Setup Screen in iOS 18
Hello, I have noticed an issue in iOS 18 where UIApplication.willResignActiveNotification and UIApplication.didBecomeActiveNotification are no longer triggered when the Siri setup screen is presented or dismissed. This behavior was working as expected in iOS 17 and earlier. This change impacts the logic in our app that relies on detecting app activation and deactivation to perform critical tasks. I would like to confirm whether this change in behavior is an intentional modification in iOS 18 or an unintended bug. Thank you for your assistance. Any additional information or guidance would be greatly appreciated. Test Environment: iOS 17: Notifications triggered as expected iOS 18: willResignActiveNotification and didBecomeActiveNotification not triggered Conditions: Occurs when presenting or dismissing the Siri setup screen
1
0
484
Dec ’24
OSLog Logger & SwiftUI
Hi, Are there any macros that can be used with Logger to automatically capture the SwiftUI function that the message originates from? Currently, I am using something similar to: Logger.misc.error("In \(#fileID), \(#function): \(error)") Currently, the #function only tells me that it originates in body... Ideally, I'd like to be able to tell if it was with an onAppear, onChange, Button, alert, etc... I realize I can manually enter this, but was wondering if there was a more automated way to capture this info. Thx,
Topic: UI Frameworks SubTopic: SwiftUI
0
0
241
Dec ’24
MapKit - render a line above everything, including annotations
I have a map application that needs to show a line (representing a direct route) that is above everything, including annotations. This is important because the map has lots of annotations (possibly hundreds) and the line is representing a route from point to another. With that many annotations being on top the line / route is basically useless because you can't see it. I've looked at things like MKOverlayLevel but it only supports .aboveRoads or .aboveLabels. Is there a way to set the z-axis of a map overlay so that it truly is on top of everything else on the map, including annotations? And if not directly in MapKit, what other options might I have? Worth noting that I'm targeting 16.4 and above, so that's my limitation on this
1
0
408
Dec ’24
VisionKit: Improve barcode scanning accuracy
Hi all, I am developing an app that scans barcodes using VisionKit, but I am facing some difficulties. The accuracy level is not at where I hope it to be at. Changing the “qualityLevel” parameter from balanced to accurate made the barcode reading slightly better, but it is still misreading some cases. I previously implemented the same barcode scanning app with AVFoundation, and that had much better accuracy. I tested it out, and barcodes that were read correctly with AVFoundation were read incorrectly with VisionKit . Is there anyway to improve the accuracy of the barcode reading in VisionKit? Or is this something that is built in and the developer cannot change? Either way, any ideas on how to improve reading accuracy would help. Thanks in advance!
0
0
434
Dec ’24
App built with Xcode 16 crashes, worked fine with Xcode 15
I'm not a developer, so my knowledge is limited. I only know enough to update the content of my app from time to time using Xcode. The app is database driven and includes hundreds of photos. It has worked fine for years and has never crashed. However, after I updated Xcode to 16.1 my app crashes when I run it on an iOS 18 Simulator. (It works fine on an iOS 17 Simulator.) The problem seems to have something to do with UItableView. Before I spend a lot of $$ for a developer to look into this, I'm wondering if the crashes might be because of a bug that will be fixed in future. Is there any way to tell? I have the crash report, but it's very long so I won't post it unless asked to. If it's helpful, this is the section of code that crashes: // MARK: UITableViewDataSource extension DetailCollectionViewCell: UITableViewDataSource { func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { guard let tableViewData = tableViewData else { fatalError("no tableViewData") } **Thread 1: fatal error: No tableViewData** return tableViewData.count
Topic: UI Frameworks SubTopic: UIKit
7
0
1.3k
Dec ’24