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

Toolbar bottomBar in DocumentGroup App disappears
In my own fairly complex DocumentGroup app, I've been having a problem with bottom bar items appearing briefly when first drawn, and then disappearing. This seems to be caused by the invalidation of one or more views in the hierarchy. In Apple's own WritingApp, which is designed to demonstrate DocumentGroup, adding a bottom bar item to the toolbar demonstrates the problem: This toolbar is on the StoryView: ToolbarItem() { Button("Show Story", systemImage: "book") { isShowingSheet.toggle() } .sheet(isPresented: $isShowingSheet) { StorySheet(story: document.story, isShowingSheet: $isShowingSheet) .presentationSizing(.page) } } // This does not persist ToolbarItem(placement: .bottomBar) { Button("Foo") { } } } My 'Foo' button is new. What happens is that it persists for a few seconds; its disappearance coincides with the writing of the file to disk, it seems. I would dearly like it to persist! I've tried adding an ID, setting the toolbar visibility and so on, but no luck. Anyone had this working?
Topic: UI Frameworks SubTopic: SwiftUI
0
0
98
1d
Should setting a UIVisualEffectView's effect to nil remove its visual glass effect?
In the WWDC 2025 session "Build a UIKit app with the with the new design", at the 23:22 mark, the presenter says: And finally, when you no longer need the glass on screen animate it out by setting the effect to nil. The video shows a UIVisualEffectView whose effect is set to a UIGlassEffect animating away as its effect is set to nil. But when I do this in my app (or a sample app), setting effect to nil does not remove the glass appearance. Is this expected? Is the video out of date? Or is this a bug?
Topic: UI Frameworks SubTopic: UIKit Tags:
7
4
84
1d
IOS cursor control
My app controls the cursor movement in a text view on iPhone and iPads. On screen touch, the IOS cursor position is out of sync with the app cursor position. Is there a way to find out, on screen touch, where the ios cursor positition is and update the app cursor to the ios cursor position? When they are out of sync, the user has to move the cursor to the startIndex and navigate from there. Frustating! I have looked at many programming books, forums, and internet search with nothing to no avail. Any help will be greatly appreciated. The app names are SummaGramPhonex and SummaGramIPAD11 and SummaGramIPAD13. Thanks. Charlie 3Sep25
0
0
129
1d
iOS 26 Beta 9 dark/light traits behaviour
I want to check if this behaviour is legit in iOS 26 Beta: We have an admittedly stranger setup where a child view controller acts as a TabBar and is a UIHostingController so that we can use SwiftUI for the tab bar items. One of the tab pages has a scrollview whose content (imagine a chat view) might go from a lighter aspect to darker colors and back when scrolling. When we scroll to predominantly dark bubbles, the trait of the tabBar changes to dark mode. The function traitCollectionDidChange() on the UIHostingController is called ! but only for the tabBar controller. I know that in iOS there is some blending going on at the tabBar level when scrolling, but changing just one view + subviews to dark mode, automatically, instead of user triggered? It might be some optimisation if the view is considered opaque? But then I would expect to not change anything visually, if opaque. Is this expected behaviour on iOS 26? And if so, can we disable it? But just this blending/ trait changing, and keep the user triggered trait changes.
Topic: UI Frameworks SubTopic: SwiftUI
0
0
121
1d
View presented as sheet are properly updated to correct color scheme
I’m facing an issue and I’d like to know if anyone has already run into this. I have a ContentView that presents a SettingsView as a sheet. SettingsView applies a change to the app’s colorScheme. ContentView reacts correctly to the change, and SettingsView does too (so far, so good). What’s strange is that when I set nil on the preferredColorScheme modifier (which, according to the docs, corresponds to the system color scheme), ContentView correctly picks up the change and refreshes, while SettingsView does pick up the change but doesn’t refresh. (In the video you can clearly see that when I switch from Dark to System, the parent view refreshes properly but not the presented sheet.) I’ve tried everything—switching to UIKit, changing the sheet’s ID… nothing works Another strange thing: if I present SettingsView through a NavigationLink, everything works normally… Here is a sample code to reproduce: import SwiftUI enum AppTheme: Int { case system = 0 case dark = 1 case light = 2 var colorScheme: ColorScheme? { switch self { case .system: return nil case .light: return .light case .dark: return .dark } } } struct SettingsView: View { @AppStorage("theme") var appTheme: AppTheme = .system var body: some View { VStack(spacing: 8) { Button { select(theme: .system) } label: { Text("Systeme") } Button { select(theme: .dark) } label: { Text("Dark") } Button { select(theme: .light) } label: { Text("Light") } } .preferredColorScheme(appTheme.colorScheme) } func select(theme: AppTheme) { appTheme = theme } } struct ContentView: View { @AppStorage("theme") var appTheme: AppTheme = .system @State var isPresented = false var body: some View { NavigationStack { VStack { Button { isPresented = true } label: { Text("Present settings") } // NavigationLink("Present settings") { // SettingsView() // } } .preferredColorScheme(appTheme.colorScheme) .sheet(isPresented: $isPresented) { SettingsView() } } } } #Preview { ContentView() }
2
0
47
1d
[iOS 26] UIVideoEditorController preview's top bar is overlapping with parent view controller
Applicaiton is built with WebKit and native camera view controller . Issue is seen always when presenting a UIVideoEditorController class on top of MainVC(webKit). Please refer the attached image Code: self.videoEditor.modalPresentationStyle = UIModalPresentationFullScreen; [viewController presentViewController:self.videoEditor animated: YES completion:nil];
3
0
89
1d
NSMutableAttributedString and NSTextTable
I'm using NSTextTable to format panels of stand-out text within body text. Paragraphs within the panel are handled as individual NSTextTableBlocks within the table. Each block is added to the NSMutableParagraphStyle that is part of the attributed string within the block's attributes. That's all fine and it works. But... Occasionally I see undrawn lines within the panel. These disappear (or sometimes appear) when the parent window (and thus the NSTextView holding the rendered attributed string) is resized. Lines do not always appear, and when they do they are not always in the same place. The height of the gap varies. I see this behaviour with these panels and with tables. What's common to both cases is not only the use of NSTextTable and NSTextTableBlock etc., but crucially (I think) the use of block margins. If I disable margins (which looks OK for the panels, but isn't right for tables), the problem disappears. So, a bug or (more likely) I'm missing a key part of view rendering or margin set up. But what? Code here: https://github.com/smittytone/PreviewMarkdown/blob/930f5f32aa0b3b77ec3f4f53436a79e10bb26f18/Markdown%20Previewer/Styler.swift#L882 Running 14.6.1 on an M3. I'm using TextKit 1 because I'm using an NSLayoutManager subclass to override certain text underlines (not used in panels as outlined above, or tables).
Topic: UI Frameworks SubTopic: AppKit
3
0
355
1d
SwiftUI NavigationSplitView doesn't work for DocumentGroup
When using a NavigationSplitView in a DocumentGroup, SwiftUI renders incorrect UI and doesn’t let the user navigation between the sidebar and detail views. Even the default Xcode project template “Document App” doesn’t work. Steps to reproduce Create a new project and use the Document App template. Run the project on either iPad or iPhone running iOS 26 beta 9 Experience the following issues. On iPhone The back button (to return to the document browser) and the document title are rendered two times. When viewing the detail of an item, by navigating to the detail view, you cannot go back to the list of items, because the back button brings you back to the document browser. The same issues are also present on iPad. I've tested this on an iPad and iPhone running iOS 26 beta 9 and Xcode 26.0 beta 7. I've reported this issue already → FB20062294
Topic: UI Frameworks SubTopic: SwiftUI
0
0
82
1d
SwiftUI's List backed by CoreData using @FetchRequest fails to update on iOS 26 when compiled with Xcode 26
Hey there! I've been tracking a really weird behavior with a List backed by @FetchRequest from CoreData. When I toggle a bool on the CoreData model, the first time it updates correctly, but if I do it a second time, the UI doesn't re-render as expected. This does not happen if I compile the app using Xcode 16 (targeting both iOS 18 and iOS 26), nor it happens when using Xcode 26 and targeting iOS 18. It only happens when building the app using Xcode 26 and running it on iOS 26. Here are two demos: the first one works as expected, when I toggle the state twice, both times updates. The second one, only on iOS 26, the second toggle fails to re-render. Demo (running from Xcode 16): Demo (running from Xcode 26): The code: import SwiftUI import CoreData @main struct CoreDataTestApp: App { let persistenceController = PersistenceController.shared var body: some Scene { WindowGroup { ContentView() .environment(\.managedObjectContext, persistenceController.container.viewContext) } } } struct ContentView: View { @Environment(\.managedObjectContext) private var viewContext @FetchRequest(sortDescriptors: [NSSortDescriptor(keyPath: \Item.timestamp, ascending: true)]) private var items: FetchedResults<Item> var body: some View { NavigationView { List { ForEach(items) { item in HStack { Text(item.timestamp!.formatted()) Image(systemName: item.isFavorite ? "heart.fill" : "heart").foregroundStyle(.red) }.swipeActions(edge: .leading, allowsFullSwipe: true) { Button(item.isFavorite ? "Unfavorite" : "Favorite", systemImage: item.isFavorite ? "heart" : "heart.fill") { toggleFavoriteStatus(item: item) } } } } .toolbar { ToolbarItem { Button(action: addItem) { Label("Add Item", systemImage: "plus") } } } } } private func addItem() { withAnimation { let newItem = Item(context: viewContext) newItem.timestamp = Date() newItem.isFavorite = Bool.random() try! viewContext.save() } } private func toggleFavoriteStatus(item: Item) { withAnimation { item.isFavorite.toggle() try! viewContext.save() } } } struct PersistenceController { static let shared = PersistenceController() let container: NSPersistentContainer init() { container = NSPersistentContainer(name: "CoreDataTest") container.loadPersistentStores(completionHandler: { _, _ in }) container.viewContext.automaticallyMergesChangesFromParent = true } }
5
0
159
1d
Source view disappearing when interrupting a zoom navigation transition
When I use the .zoom transition in a navigation stack, I get a glitch when interrupting the animation by swiping back before it completes. When doing this, the source view disappears. I can still tap it to trigger the navigation again, but its not visible on screen. This seems to be a regression in iOS 26, as it works as expected when testing on iOS 18. Has someone else seen this issue and found a workaround? Is it possible to disable interrupting the transition? Filed a feedback on the issue FB19601591 Screen recording: https://share.icloud.com/photos/04cio3fEcbR6u64PAgxuS2CLQ Example code @State var showDetail = false @Namespace var namespace var body: some View { NavigationStack { ScrollView { showDetailButton } .navigationTitle("Title") .navigationBarTitleDisplayMode(.inline) .navigationDestination(isPresented: $showDetail) { Text("Detail") .navigationTransition(.zoom(sourceID: "zoom", in: namespace)) } } } var showDetailButton: some View { Button { showDetail = true } label: { Text("Show detail") .padding() .background(.green) .matchedTransitionSource(id: "zoom", in: namespace) } } }
Topic: UI Frameworks SubTopic: SwiftUI
3
3
69
1d
NavigationSplitView + inspector causes Sidebar state issues on Mac Catalyst
Hi everyone! I've encountered an issue on Mac Catalyst: using the latest inspector modifier causes abnormal Sidebar and Columns state in NavigationSplitView. Sample Code: struct ContentView: View { @State private var isPresented = false var body: some View { NavigationSplitView { List { ForEach(0..<20, id: \.self) { item in Text("Item \(item)") } } } content: { List { ForEach(0..<20, id: \.self) { item in Text("Item \(item)") } } } detail: { List { } } .inspector(isPresented: $isPresented) { Form { } } } } Steps to reproduce: Xcode 16 beta 7, create a new iOS project Paste the code above Enable Mac Catalyst Run on Mac (macOS 15 beta 9) Press Command+N three times to open 3 new windows Click the Sidebar Toggle button The issue occurs (see screenshot below) Through testing, I found that as long as the inspector modifier is attached, the issue occurs. Also, the problem only appears in the 3rd and subsequent newly opened windows—the first two windows work as expected. FB20061521
0
0
72
1d
Custom Keyboard help
import UIKit class KeyboardViewController: UIInputViewController { // MARK: - Properties private var keyboardView: KeyboardView! private var heightConstraint: NSLayoutConstraint! private var hasInitialLayout = false // 存储系统键盘高度和动画参数 private var systemKeyboardHeight: CGFloat = 300 private var keyboardAnimationDuration: Double = 0.25 private var keyboardAnimationCurve: UIView.AnimationOptions = .curveEaseInOut // MARK: - Lifecycle override func viewDidLoad() { super.viewDidLoad() setupKeyboard() } override func viewWillAppear(_ animated: Bool) { super.viewWillAppear(animated) // 在视图显示前更新键盘高度,避免闪动 if !hasInitialLayout { hasInitialLayout = true } } override func viewDidAppear(_ animated: Bool) { super.viewDidAppear(animated) } // MARK: - Setup private func setupKeyboard() { // 创建键盘视图 keyboardView = KeyboardView() keyboardView.translatesAutoresizingMaskIntoConstraints = false view.addSubview(keyboardView) // 设置约束 - 确保键盘贴紧屏幕底部 NSLayoutConstraint.activate([ keyboardView.leftAnchor.constraint(equalTo: view.leftAnchor), keyboardView.rightAnchor.constraint(equalTo: view.rightAnchor), keyboardView.bottomAnchor.constraint(equalTo: view.bottomAnchor) ]) // 设置初始高度约束(使用系统键盘高度或默认值) let initialHeight = systemKeyboardHeight heightConstraint = keyboardView.heightAnchor.constraint(equalToConstant: initialHeight) heightConstraint.isActive = true } // MARK: - Layout Events override func viewDidLayoutSubviews() { super.viewDidLayoutSubviews() } override func viewSafeAreaInsetsDidChange() { super.viewSafeAreaInsetsDidChange() } // MARK: - 键盘高度请求 // 这个方法可以确保键盘扩展报告正确的高度给系统 override func updateViewConstraints() { super.updateViewConstraints() // 确保我们的高度约束是最新的 if heightConstraint == nil { let height = systemKeyboardHeight &gt; 0 ? systemKeyboardHeight : 216 heightConstraint = NSLayoutConstraint( item: self.view!, attribute: .height, relatedBy: .equal, toItem: nil, attribute: .notAnAttribute, multiplier: 0.0, constant: height ) heightConstraint.priority = UILayoutPriority(999) view.addConstraint(heightConstraint) } else { let height = systemKeyboardHeight &gt; 0 ? systemKeyboardHeight : 216 heightConstraint.constant = height } } } // MARK: - Keyboard View Implementation class KeyboardView: UIView { private var keysContainer: UIStackView! override init(frame: CGRect) { super.init(frame: frame) setupView() } required init?(coder: NSCoder) { super.init(coder: coder) setupView() } private func setupView() { backgroundColor = UIColor(red: 0.82, green: 0.84, blue: 0.86, alpha: 1.0) // 创建按键容器 keysContainer = UIStackView() keysContainer.axis = .vertical keysContainer.distribution = .fillEqually keysContainer.spacing = 8 keysContainer.translatesAutoresizingMaskIntoConstraints = false addSubview(keysContainer) // 添加约束 - 确保内容在安全区域内 NSLayoutConstraint.activate([ keysContainer.topAnchor.constraint(equalTo: safeAreaLayoutGuide.topAnchor, constant: 8), keysContainer.leftAnchor.constraint(equalTo: safeAreaLayoutGuide.leftAnchor, constant: 8), keysContainer.rightAnchor.constraint(equalTo: safeAreaLayoutGuide.rightAnchor, constant: -8), keysContainer.bottomAnchor.constraint(equalTo: safeAreaLayoutGuide.bottomAnchor, constant: -8) ]) // 添加键盘行 } }
Topic: UI Frameworks SubTopic: UIKit Tags:
2
0
35
1d
CarPlay app not receiving data updates when iPhone screen is locked
We are building a CarPlay app and have run into an issue with data updates. When the app is running on the CarPlay display and the iPhone screen is locked, no data updates are shown on the CarPlay screen. As soon as the phone is unlocked, the data updates appear instantly on the CarPlay display. Has anyone encountered this behavior before? Is there a specific setting, entitlement, or background mode we need to enable in order to ensure the CarPlay app continues to receive and display data while the iPhone is locked? Any guidance would be greatly appreciated.
0
0
54
1d
Unexpected Widget Refresh When Pausing or Playing Music in iOS App
Widget abnormal refresh My app is a music application. When playing or pausing a song, the status is synchronized to NowPlaying, and the app itself supports widgets. During testing, I found that when pausing or playing music, the widget triggers a timeline refresh, which is completely unexpected. However, switching songs does not cause this. Looking at Apple’s logs: By default 21:27:08.094490+0800 mediaremoted Set: origin-iPhone-1280262988/client-com.company.musicdev-10059 (music)/player-MediaRemote-DefaultPlayer setting inferred playback state from to By default 21:27:08.094607+0800 mediaremoted [MRDNowPlayingPlayerClient] PlaybackState changed from Playing to Paused for origin-iPhone-1280262988/client-com.company.musicdev-10059 (music)/player-MediaRemote-DefaultPlayer By default 21:27:08.094713+0800 mediaremoted [MRDNowPlayingPlayerClient] isPlaying changed to false for origin-iPhone-1280262988/client-com.company.musicdev-10059 (music)/player-MediaRemote-DefaultPlayer By default 21:27:08.111861+0800 mediaremoted Posted Active Now Playing Notification kMRMediaRemoteNowPlayingApplicationPlaybackStateDidChangeNotification for path origin-iPhone-1280262988/client-com.company.musicdev-10059 (music)/player-MediaRemote-DefaultPlayer By default 21:27:08.115550+0800 mediaremoted Response: handlePlaybackQueueRequest<B0BDBB4E-C539-4D39-B51C-718115EBD7C4 assistantd-2659 /M/L/AF/R[0:1]> returned for origin-iPhone-1280262988/client-com.company.musicdev-10059 (music)/player-MediaRemote-DefaultPlayer in 0.0005 seconds By default 21:27:08.119344+0800 assistantd Response: playbackQueue<B0BDBB4E-C539-4D39-B51C-718115EBD7C4 assistantd-2659 /M/L/AF/R[0:1]> returned <> for origin-iPhone-1280262988/client-com.company.musicdev-10059 (music)/player-MediaRemote-DefaultPlayer in 0.0010 seconds By default 21:27:08.122322+0800 SpringBoard Response: playbackState<63A30582-E3C2-4F4D-AC57-8E5841FAD568> returned for origin-iPhone-1280262988/client-com.company.musicdev-10059 (music)/player-MediaRemote-DefaultPlayer in 0.0005 seconds By default 21:27:08.126132+0800 chronod Observed com.company.musicdev stopped running for exempt reason: nowPlaying - remainingReasons: None By default 21:27:08.126285+0800 chronod [com.company.musicdev::com.company.musicdev.musicdesktopwidget:VisionWidget_medium4158108784:systemMedium:3758765227620768254:338.00/158.00/21.60:(null)~(null)] on local marked as requiring reload By default 21:27:08.126455+0800 chronod [com.company.musicdev::com.company.musicdev.musicdesktopwidget:VisionWidget_medium4158108784:3758765227620768254] Reload with configuration [systemRequest(sessionEnded)-immediate-free-1] By default 21:27:08.126854+0800 mediaremoted Response: handlePlaybackQueueRequest<ACF764D9-05A6-41FF-8BB5-8CB81A8BC163 assistantd-2659 /M/L/AF/R[0:1]> returned for origin-iPhone-1280262988/client-com.company.musicdev-10059 (music)/player-MediaRemote-DefaultPlayer in 0.0008 seconds By default 21:27:08.127960+0800 assistantd Response: playbackQueue<ACF764D9-05A6-41FF-8BB5-8CB81A8BC163 assistantd-2659 /M/L/AF/R[0:1]> returned <> for origin-iPhone-1280262988/client-com.company.musicdev-10059 (music)/player-MediaRemote-DefaultPlayer in 0.0016 seconds By default 21:27:08.128091+0800 wifid Response: playbackState returned for origin-iPhone-1280262988/client-com.company.musicdev-10059 (music)/player-MediaRemote-DefaultPlayer in 0.0115 seconds When the music state changes, you can see the widget is triggered to refresh. I want to ask if this is the system’s mechanism? I checked my code and there is no operation to actively refresh the widget when pausing or playing. Can this situation be avoided?
0
0
88
1d
iPadOS: remove system actions from Menu Bar
Hi, I am setting up the iPadOS26 Menu Bar, and it comes with some existing menu items that don't make sense for my app. For example, under "File" menu, there are options for New Window, Duplicate, Move, Rename and Export that I would like to remove (which keeping the Close Window option). What's the best way to do this?
Topic: UI Frameworks SubTopic: UIKit
3
0
115
1d
Dividers not appearing in menu bar on iPadOS 26
On macOS 26 I can see the dividers when I open my Help menu: However, on iPadOS 26 the dividers don't appear: I am simply using Divider() to separate my menu bar items in my CommandGroup. iPadOS does support dividers as I can see them for the system generated Edit menu but for some reason it's not working here. Does anyone know if I am doing something wrong with the iPadOS implementation?
2
1
69
2d
Touch Input Offset and Unresponsive Elements in iOS 18.6 (Xcode 16.4)
PLATFORM AND VERSION iOS Development environment: Xcode 16.4, macOS 15.6 Run-time configuration: iOS 18.6 DESCRIPTION OF PROBLEM Hi, We recently noticed some issues when running our existing app, even after applying updates, on iOS 18.6. The problem occurs both on the Xcode simulator and on clients’ mobile devices running iOS 18.5 or later. However, devices running versions below 18.5, such as iOS 18.4 (including iPads), do not experience this issue. The issue we are experiencing is that when we touch certain elements, they do not respond unless we tap slightly higher than the intended point. Please see the video in the link below. I believe others are also experiencing similar touch-related issues, though not identical to ours. On iOS 18.4: Works as expected. On iOS 18.6: The range bar cannot be moved unless we tap slightly above it, and once the map is displayed, the toggle button becomes non-functional. This behaviour is not present in any earlier iOS version. I suspect something may have changed in the OS that is causing this issue, possibly related to plugins, or perhaps something in Xcode that needs to be updated. We would greatly appreciate your guidance in resolving this matter. STEPS TO REPRODUCE Please see the following videos 18.4, performing as expected. https://screenrec.com/share/ASczNx0MRh 18.6, with issues https://screenrec.com/share/MR4VpyIBks 18.6 with the issue
Topic: UI Frameworks SubTopic: General
4
0
142
2d
iPadOS keyboard formatting options
Hi, When I have a UITextView displayed on screen and in focus, the iPad keyboard shows buttons to Bold, Italics and Underline text (since it supports attributed text), and also a 'formatting' button that allows the user to change the font, color and size of the text, as well as justify text and add numbered lists and bullet points. Is there any way to disable or remove this 'formatting' button? My app doesn't support saving these options (other than bold, italics and underline), so it confuses users to see this option. Thanks.
Topic: UI Frameworks SubTopic: UIKit
0
0
99
2d
iOS 26 Liquid Glass not showing
I’m not seeing Liquid Glass on any standard components. A month ago around July 17th I ran our app and saw Liquid Glass on our tab view and various standard components. Those components have not been changed and yet I’m no longer seeing Liquid Glass in our app at all. Components that were previously liquid glass but now are not include TabView and back navigation buttons. I set the UIDesignRequiresCompatibility key explicitly to false but no luck. I was seeing this in Beta 7 and Beta 8 on a real device and on a sim.
1
0
103
2d