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

Complications not showing up after WatchOS 26
We are having an issue with our app after upgrading to WatchOS 26. After some time our complication disappears from the watch face. If you go to add it back, our app shows up with an empty icon placeholder and you are unable to tap it to add it back. Sometimes restarting the watch will bring it back, sometimes it does not. Has anyone experienced this? What should we be looking at to figure out why this is happening? Or could this be a bug in WatchOS 26?
3
0
165
2w
Navigation Bar Occupies Too Much Space in iOS 26 Landscape Orientation
I’m really frustrated with iOS 26. It was supposed to make better use of screen space, but when you combine the navigation bar, tab bar, and search bar, they eat up way too much room. Apple actually did a great job with the new tab bar — it’s smaller, smooth, and looks great when expanding or collapsing while scrolling. The way the search bar appears above the keyboard is also really nice. But why did they keep the navigation bar the same height in both portrait and landscape? In landscape it takes up too much space and just looks bad. It was way better in iOS 18.
2
0
132
2w
iOS 26 UITargetedPreview not responding to touches
We have a UICollectionView whose cells have custom context menu highlight previews. In the delegate method collectionView(_:contextMenuConfiguration:highlightPreviewForItemAt:), we build a UITargetedPreview whose custom view contains some action buttons. Up until iOS 18, our setup has been working perfectly. But since iOS 26, the custom view is not responding to touches. When the user taps one of its buttons, the context menu gets dismissed as if the touch was outside of the custom view. Is there any UICollectionView-related API change in version 26?
Topic: UI Frameworks SubTopic: UIKit Tags:
2
0
130
2w
How to display a toast view above both main content and FullScreenCover in SwiftUI?
I'm using a ZStack with viewA() and a toast viewB(). I present a FullScreenView() using .fullScreenCover(isPresented:). ZStack { viewA() viewB() // toast view } .fullScreenCover(isPresented: $isPresented) { FullScreenView() } I want viewB (the toast) to appear above both viewA and the FullScreenView. I only found this approach works but it has duplicate code. ZStack { viewA() viewB() // toast view } .fullScreenCover(isPresented: $isPresented) { ZStack { FullScreenModalView() viewB() // toast view } } What are all possible approaches to achieve this in SwiftUI? Any advice or code samples would be appreciated!
Topic: UI Frameworks SubTopic: SwiftUI
1
0
76
2w
Focusable doesn't work on iPad with external keyboard
I have a custom input view in my app which is .focusable(). It behaves similar to a TextField, where it must be focused in order to be used. This works fine on all platforms including iPad, except when when an external keyboard is connected (magic keyboard), in which case it can't be focused anymore and becomes unusable. Is there a solution to this, or a workaround? My view is very complex, so simple solutions like replacing it with a native view isn't possible, and I must be able to pragmatically force it to focus. Here's a very basic example replicating my issue. Non of the functionality works when a keyboard is connected: struct FocusableTestView: View { @FocusState private var isRectFocused: Bool var body: some View { VStack { // This text field should focus the custom input when pressing return: TextField("Enter text", text: .constant("")) .textFieldStyle(.roundedBorder) .onSubmit { isRectFocused = true } .onKeyPress(.return) { isRectFocused = true return .handled } // This custom "input" should focus itself when tapped: Rectangle() .fill(isRectFocused ? Color.accentColor : Color.gray.opacity(0.3)) .frame(width: 100, height: 100) .overlay( Text(isRectFocused ? "Focused" : "Tap me") ) .focusable(true, interactions: .edit) .focused($isRectFocused) .onTapGesture { isRectFocused = true print("Focused rectangle") } // The focus should be able to be controlled externally: Button("Toggle Focus") { isRectFocused.toggle() } .buttonStyle(.bordered) } .frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .center) } }
1
0
124
2w
Symbol Effects Cause Crash When Switching Between Conditional `.fill` SF Symbols
I am reporting a consistent EXC_BAD_ACCESS (SIGSEGV) crash when using the .contentTransition(.symbolEffect(.replace.byLayer)) modifier on a conditional $SF$ Symbol, but only under very specific conditions: Both Symbols must be .fill variants (e.g., arrow.up.circle.fill $\leftrightarrow$ plus.circle.fill). The crash only occurs when the state changes and the view attempts to transition back to the original symbol (the one present when the view was first rendered). For example, if the initial state displays arrow.up.circle.fill, the app successfully transitions to plus.circle.fill. However, the app crashes when the state changes again, attempting to transition from plus.circle.fill back to arrow.up.circle.fill.This crash is fully reproducible in the iOS Simulator and is not limited to Xcode Previews. Commenting out the .contentTransition modifier resolves the crash immediately. The crash is a KERN_INVALID_ADDRESS at 0x0000000000000060, pointing to a null pointer dereference deep within the graphics rendering pipeline in the RenderBox framework. It appears to be a failure in handling the layer data during the reverse transition of two filled-variant symbols. Exception Type: EXC_BAD_ACCESS (SIGSEGV) Exception Subtype: KERN_INVALID_ADDRESS at 0x0000000000000060 Thread 0 Crashed: 0 RenderBox 0x1cc692a0c RB::Symbol::Glyph::Layer::resolve_draw_transforms(...) + 292 1 RenderBox 0x1cc692730 RB::Symbol::Glyph::Layer::append_path(...) + 392 ... 7 SwiftUICore 0x1d9d5f824 specialized _ShapeStyle_RenderedShape.renderVectorGlyph(...) + 1444 The code below crashes on the second tap (transitioning back to arrow.up.circle.fill): struct QuickAddButtonTest: View { @State private var isTextFieldFocused: Bool = false // Both symbols use the .fill variant var body: some View { Button(action: { isTextFieldFocused.toggle() }) { Image(systemName: isTextFieldFocused ? "arrow.up.circle.fill" : "plus.circle.fill") .foregroundColor(.primary) .font(.system(size: 30)) .contentTransition(.symbolEffect(.replace.byLayer)) // <-- CRASH SOURCE } } } The crash can be avoided by: Removing the .contentTransition(.symbolEffect(.replace.byLayer)) modifier, or Switching one or both symbols to a non-filled variant (e.g., plus.circle instead of plus.circle.fill).
1
0
57
2w
Menu List Error
Hi, I'm trying to have a menu at the trailing edge of a list but when I do so I am getting UIKit errors. I pasted my sample code below. Not exactly sure how to fix this. ForEach(0..<100) { i in HStack { Text("\(i)") Spacer() Menu { Text("Test") } label: { Image(systemName: "ellipsis") } } } } Adding '_UIReparentingView' as a subview of UIHostingController.view is not supported and may result in a broken view hierarchy. Add your view above UIHostingController.view in a common superview or insert it into your SwiftUI content in a UIViewRepresentable instead.
Topic: UI Frameworks SubTopic: SwiftUI
2
0
119
2w
PDF's base64 is missing when using MailKit Message.rawData
Hello, I'm trying to build a MailKit extension that parses PDFs. My extension initially gets the call for decide action, I request invokeAgain. func decideAction(for message: MEMessage, completionHandler: @escaping (MEMessageActionDecision?) -> Void) { guard let data = message.rawData else { completionHandler(MEMessageActionDecision.invokeAgainWithBody) return } let content = String(data: data, encoding: .utf8) print(content) When I try to reconstruct the PDF attached: I find the headers, and the text content, but I don't see the base64 content of the PDF file. Is there something I'm missing here? Thanks in advance
0
0
82
2w
Scrolling UICollectionView inside a container view scrolls navigation controller title
I am trying to understand if what I am seeing is expected behavior or not with the following UIKit components. 1.I have a view controller "A" embedded in a navigation controller (part of a multi-step flow). Large titles are active on this navigation controller. In this view controller "A", I have a container view that contains another view controller "B" (I want to reuse the contents of B in other flows) Inside view controller "B" I have a UICollectionView using a diffable data source. When you load view controller "A" it appears to work fine. My collection view loads data, I see a nice list and when I scroll it... ... the expectation is it scrolls inside it's container and has no impact on the parent controller "B" However, the navigation bar and title in "A" reflect the content offset of the collection view. Scroll a couple lines, the large title turns small and centered on top. If I turn off large title, I still see the background color of the navigation bar change as it would if you were scrolling a view directly inside controller "A" without the container view. Am I supposed to be manually capturing the gesture recognizer in B and somehow preventing the gesture to bubble up to A? It seems like strange behavior to have to correct. Any suggestions? Thanks!
Topic: UI Frameworks SubTopic: UIKit Tags:
4
0
1.4k
2w
How to prevent VoiceOver from reading text INSIDE an image?
In the example below, VoiceOver (in both iOS 18 and 26) reads the text contained within the image after the .accessibilityLabel, introduced by a “beep.” VoiceOver: Purple rounded square with the word 'Foo' in white letters. Image [beep] foo. I’d like it to only read the accessibility label. As a developer focused on accessibility, I make sure every image already has an appropriate label, so having iOS read the image text is redundant. Sample Code import SwiftUI struct ContentView: View { var body: some View { Image("TextInImage") .resizable() .scaledToFit() .frame(width: 64, height: 64) .accessibilityLabel("Purple rounded square with the word 'Foo' in white letters.") } } Sample Image Drop this image in to Assets.xcassets and confirm it's named TextInImage.
4
0
172
2w
List rows disappearing when scrolling
I have a List containing ItemRow views based on an ItemDetails object. The content is provided by a model which pulls it from Core Data. When I scroll through the list one or two of the rows will disappear and reappear when I scroll back up. I have a feeling it's because the state is being lost? Here's some relevant info (only necessary parts of the files are provided): -- ModelData.swift: @Observable class ModelData { var allItems: [ItemDetails] = coreData.getAllItems() ... } -- ItemDetails.swift: struct ItemDetails: Identifiable, Hashable, Equatable { public let id: UUID = UUID() public var itemId: String // Also unique, but used for a different reason ... } -- MainApp.swift: let modelData: ModelData = ModelData() // Created as a global class SceneDelegate: UIResponder, UIWindowSceneDelegate { // Methods in here (and in lots of other places) use `modelData`, which is why it's a global } @main struct MainApp: App { var body: some Scene { WindowGroup { MainView() } } ... } -- MainView.swift: struct MainView: View { var body: some View { List { ForEach(modelData.allItems, id: \.id) { item in ItemRow(item) } } } } struct ItemRow: View, Equatable { var item: ItemDetails var body: some View { ... } static func == (lhs: Self, rhs: Self) -> Bool { lhs.item == rhs.item } } There's obviously more code in the app than that, but it's not relevant to the issue. I've tried: ItemRow(item).equatable() Wrapping ItemRow in an EquatableView Giving the List a unique id Using class ModelData: ObservableObject and @StateObject for modelData None made any difference. I'm using iOS/iPadOS 26.0.1, and I see it on my physical iPhone 17 Pro Max and iPad Pro 11-inch M4, but I don't see it in the equivalent simulators on those versions. The Simulator also doesn't exhibit this for versions 17.5 and 18.5, and I have no physical devices on 17.5/18.5 to check. Should I be doing as I currently am, where I create modelData as a global let so I can access it everywhere, or should I pass it through the view hierarchy as an Environment variable, like @Environment(ModelData.self) var modelData: ModelData? Bear in mind that some functions are outside of the view hierarchy and cannot access modelData if I do this. Various things like controllers that need access to values in modelData cannot get to it. Any ideas? Thanks.
2
0
107
2w
Add a value to the Photos Caption field
In the iOS Photos app there is a caption field the user can write to. How can you write to this value from Swift when creating a photo? I see apps that do this, but there doesn't seem to be any official way to do this using the Photo library through PHAssetCreationRequest or PHAssetResourceCreationOptions or setting EXIF values, I tried settings a bunch of values there including IPTC values but nothing appears in the caption field in the iOS photos app. There must be some way to do it since I see other apps setting that value somehow after capturing a photo.
1
1
94
3w
Automating pickerWheels in VisionOS
Hi! I am learning Swift and UIKit for work. I am trying to automate using a pickerWheel in VisionOS, but since .adjust(toValue: ) was removed in VisionOS's API, I am absolutely struggling to find a way to set a pickerWheel to a specific value. Currently, my solution is to calculate the amount of times I would need to increment/decrement the wheel to get from the current value to the desired value, then do so one at a time. However, this currently does not work, as .accessibilityIncrement() and .accessibilityDecrement() do not work, and .swipeUp() and .swipeDown() go too far. What can I do? Note: I am not a frontend engineer, so while solutions may exist that involve changes to the frontend, I would much rather try and get the frontend we do have to work as is.
1
0
60
3w
Prevent default file selector in a SwiftUI DocumentGroup app and show a custom welcome window on launch
I’m building a macOS document based app using SwiftUI’s DocumentGroup API. By default, when a document based app launches, macOS automatically shows a file open panel or creates a new untitled document window. However, I want to suppress this default behavior and instead show a custom welcome window when the app starts — something similar to how Xcode or Final Cut Pro shows a “Welcome” or “Start Project” screen first. So basically, when the user opens the app normally, it should not open the document selector or create a document automatically. Instead, it should show my custom SwiftUI or AppKit window. Here is my Code :- //MyApp.swift import SwiftUI import AppKit @main struct PhiaApp: App { @NSApplicationDelegateAdaptor(AppDelegate.self) var appDelegate var body: some Scene { DocumentGroup(newDocument: MyDocumentModel()) { file in EditorView(document: file.document, filePath: file.fileURL) } Settings { EmptyView() } } } Current I have this code setup for my MainApp.swift, where I am using the AppDelegate to create a custom recording window using appkit and also defining the DocumentGroup to handle the custom .myapp file opens. However, when I launch the app, its showing my appkit window as well as the macOs native file Selector to select the file I want to open. I want when the user opens the app normally, it should not open the document selector or create a document automatically. Instead, it should show my custom SwiftUI or AppKit window. However, the app should still fully support opening .myapp documents by double clicking from Finder, using the standard File → Open and File → New menu options, also having multiple document windows open at once. This is my AppDelegate.swift file :- import AppKit import SwiftUI class AppDelegate: NSObject, NSApplicationDelegate { var panel: Panel? private var statusItem: NSStatusItem? func applicationDidFinishLaunching(_ notification: Notification) { showWindow() } // MARK: - Window control func showWindow() { if panel == nil { let root = RecordingViewMain() let newPanel = Panel(rootView: root) if let screen = NSScreen.main { let size = NSSize(width: 360, height: 240) let origin = NSPoint( x: screen.visibleFrame.midX - size.width / 2, y: screen.visibleFrame.midY - size.height / 2 ) newPanel.setFrame(NSRect(origin: origin, size: size), display: true) } panel = newPanel } panel?.makeKeyAndOrderFront(nil) } func hideWindow() { panel?.orderOut(nil) } @objc private func showPanelAction() { showWindow() } @objc private func quitAction() { NSApp.terminate(nil) } }
2
0
164
3w
Hiding Writing Tools and AutoFill menu items
Hi, I develop a 3D molecular editor, so the Writing Tools and AutoFill menu items don't make much sense. Is it possible to hide these menu items in my app? In the case of dictation and the character palette, I can do this: [[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"NSDisabledDictationMenuItem"]; [[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"NSDisabledCharacterPaletteMenuItem"]; Is there some similar way to remove the Writing Tools and AutoFill menu items for apps in which they don't make sense?
Topic: UI Frameworks SubTopic: General
0
0
38
3w
UIDocumentPickerViewController freezes the second time it's called on iOS and iPadOS 26.1 betas 3 and 4
Hello, this is very weird. I have an app where I use UIDocumentPickerViewController(forOpeningContentTypes: [.folder]) to let the users access to directories that are in the sandbox of other apps. It's been working since iOS 13. On the beta versions of iOS and iPadOS 26.1 (betas 3 and 4), the second time the UIDocumentPickerViewController is presented, it becomes unresponsive, with a spinning wheel in the top right corner where the "Open" button should be. I have absolutely no clue what the issue could be. It doesn't seem to be a widespread issue, but I have also no idea on how to find the origin and fix it. As far as I can tell from the debugger, this line is executed: DispatchQueue.main.async { rootVC?.present(self.documentPicker, animated: true, completion: nil) } and then nothing else happens.
Topic: UI Frameworks SubTopic: UIKit
0
0
59
3w
onContinueUserActivity(CSSearchableItemActionType, perform) does not work on a SwiftUI macOS app
onContinueUserActivity(CSSearchableItemActionType, perform) works as expected on iOS when we search and select an item from Spotlight, but nothing happens when we do the same on a SwiftUI macOS app. var body: some Scene { WindowGroup { MyView() .onContinueUserActivity(CSSearchableItemActionType, perform: handleSpotlight) } } func handleSpotlight(_ userActivity: NSUserActivity) { // Is not called... } How can we respond to a user clicking a Spotlight result from our apps on macOS?
3
1
842
3w
Customizable Toolbar on iPadOS26 seems not customizable
Hi, I have started app development fairly recently and I decided to develop for Apple due to the fact that my school uses iPads and they were so convincing that I decided to buy more Apple products adding to the experience with the iPad such as a Mac where I learned Xcode, Swift and SwiftUI as far as I could comprehend. I am working on a document based app for my school and I want to implement a toolbar that’s user customizable. There seems to be no way to get a customizable toolbar running on iPadOS26 though iPadOS16 has supported this feature and it has been till 18, I believe. I have set up a doc-based app in Xcode and that and all of its views do work except the toolbar that I added to my NavigationSplitView. The items show, when their defaultCustomization isn’t set to .hidden. The toolbar is given an id and the items are all wrapped in the ToolbarItem structure that also is given an id and the placement of .secondaryAction. The items show up and behave as expected in terms of grouping and making space if there isn’t enough room for all items so some appear in the overflow menu. From apps like Preview, Reminders and MindNode I know that the customization is supposed to still be available but it lives in the menu bar, where I haven’t seen it under view. It seems like there is a thing that my toolbar does not conform to or that there is a method that‘s called, when the user wants to customize the toolbar that I don’t know about. I would much appreciate a quick fix, solution or suggestion.
1
0
120
3w