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

Created

WebPage and WebView and status bar
I am using WebView and WebPage to display web pages. Some web pages have content fixed to the top of the screen (like apple.com). When this happens, content is under the status bar (like menu buttons), and I cannot tap them. My work around is to put the WebView in a VStack with the top being Color.clear.frame(height: 44). It isn't very elegant, especially since it is applied to all pages and not just pages with fixed content at the top. Is there a more Apple-y way to solve this? For example, Safari seems to detect these situations and puts something like Color.clear.frame(height: 44) in those cases but not other cases. Here is sample code: import SwiftUI import WebKit struct ContentView: View { @State private var page: WebPage init() { let configuration = WebPage.Configuration() page = WebPage(configuration: configuration) let url = URL(string: "https://www.apple.com")! let request = URLRequest(url: url) page.load(request) } var body: some View { WebView(page) } } Here is a screenshot of Apple's page in WebView with the menu Here is a screenshot of Apple's page in Safari. It appears to have inserted a spacer frame at the top for Apple's page (but not, for example, my own web site which doesn't have this problem).
0
0
127
3w
UIDocument crashes when overriding writeContents(_:) in Swift 6
I’ve been trying to set up a UIDocument and override writeContents(...). This works correctly in older projects, but I haven’t been able to get it working in my new iOS 26 app using Swift 6. To troubleshoot, I tested the Particles demo and successfully overrode writeContents there. However, as soon as I switch that project to iOS 26 and Swift 6, calling save; which triggers writeContents, causes the same crash. override public func writeContents( _ data: Any, to url: URL, for _: UIDocument.SaveOperation, originalContentsURL _: URL?, ) throws { ... } Thread 10 Queue : UIDocument File Access (serial)
Topic: UI Frameworks SubTopic: UIKit
1
0
81
3w
Swift UI Custom Keyboard
How can I correctly display the cursor using a custom keyboard in SwiftUI without using UIKit? Currently, I'm encountering a conflict between the custom keyboard and the system keyboard in SwiftUI, resulting in both keyboards being displayed simultaneously. If I disable the system keyboard and then handle the custom keyboard, the cursor disappears. How can I resolve this issue?it?
0
0
76
3w
How to add view below navigation bar to extend scroll edge effect
Hello! What UIKit API enables you to add a view below the navigation bar and extend the scroll edge effect below it in iOS 26? safeAreaBar is how you do it in SwiftUI but I need to achieve this design in my UIKit app (which has a collection view in a view controller in a navigation controller). struct ContentView: View { let segments = ["First", "Second", "Third"] @State private var selectedSegment = "First" var body: some View { NavigationStack { List(0..<50, id: \.self) { i in Text("Row \(i + 1)") } .safeAreaBar(edge: .top) { Picker("Segment", selection: $selectedSegment) { ForEach(segments, id: \.self) { Text($0) } } .pickerStyle(.segmented) .padding(.horizontal) .padding(.bottom, 8) } .navigationTitle("Title") .navigationBarTitleDisplayMode(.inline) } } }
3
1
404
3w
[UIKit Glass Effect] - Opacity change from 0 to 1 does not work
When a UIVisualEffect with glass effect view is added with opacity 0, it remains hidden as expected. But when changing it back to 1 should make it visible, but currently it stays hidden forever. The bug is only reproducible on iOS 26.1 and iOS 26.2. It does not happen on iOS 26.0. The issue is also not reproducible with UIBlurEffect. Only happens for Glass effect Here is the repro link
2
0
193
3w
SwiftUI: Menu icon will missing if increase preferred text size
iOS simulator version 18.0+ I have a demo like this: Menu { Button { } label: { Text("Option 1") Image(systemName: "star") } Button { } label: { Text("Option 2") Image(systemName: "star") } } label: { Text("Menu") } And I used the tool Accessibility Inspector to modify the text size. Case 1: We could see the option title and the star icon. Case 2: But we could not see the icon, only the option title here Is this by design from Apple? Or does this need to be fixed? Does anyone know about my question?
0
0
65
3w
Fast Loading Thumbnails in Gallery Similar to iOS Photos App
I’m building a photo‑gallery view that mimics the iOS Photos app when it’s zoomed in to the maximum level: all years are displayed at once, with roughly 400 tiny thumbnails per page. The user experience of the system app is that the view is instantly visible, and scrolling keeps thumbnails instantly appearing. I’ve already tried fetching thumbnails with PHImageManager and PHCachingImageManager, requesting the .fastFormat representation. However, the thumbnails still take several seconds to load, so the scrolling experience is noticeably laggy compared to the system app. Is there another approach or technique—perhaps a different caching strategy, pre‑fetching, or a lower‑level API—that would allow me to retrieve and display thumbnails as quickly (or faster) than the native Photos app? Any guidance or code snippets would be greatly appreciated.
0
0
100
3w
UIHostingController adds extra backgrounds on iOS 26.1, breaks Liquid Glass effect
I was trying to figure out why my bottom sheet looks weird and doesn't have the "proper glass" look. I found that this issue seems to be new to iOS 26.1. See the images below, they show the same view hierarchy (in this case UIHostingController configured as bottom sheet that has NavigationStack and content. On iOS 26.1 there seems to be extra two layers of background - even though I am no adding any. iOS 26: iOS 26.1 Has anyone experienced something similar? Any workarounds? I am happy to completely disable the glass effect for this bottom sheet if it helps. The screenshots show one sheet, but the same thing happens for another ones.
1
2
146
3w
.glasseffect with multiple date pickers
Hello, I'm having a problem with the .glasseffect modifier in a view of a SwiftUI application. I have a list that starts with a static element, followed by several dynamic entries, and then another static element. I've applied the .glasseffect modifier to all the elements, and it works fine except for the first static element. I think I've figured out what's causing it. This element contains two date pickers, and if I comment one out, it works. As soon as both are present, I get a BAD_ACCESS_ERROR. Oddly enough, this only happens on the tablet. Everything runs normally in the simulator. If I remove the .glassmodifier and use a normal background, it still works. Is this a bug, or is it against Liquid Glass to have two date pickers in a stack and then use the .glasseffect modifier?
1
0
105
3w
How to Constrain a TableView Cell Similarly to Apple's Settings App
Hello! I'm creating a settings page for my app and I want it to look as native as possible. I want to know if it's possible to add constraints that make the second label go to the bottom when the text size gets really large (see Picture1) instead of having to force it to be on the right (see Picture 2). I've left my constraint code for this cell down below, too. I'm still learning constraints and best practices, so if there's any feedback, I'd love to hear it. Thank you! Picture 1 Picture 2 - (void) setConstraints { [NSLayoutConstraint activateConstraints:@[ // Cell Title Label [self.themeColorLabel.leadingAnchor constraintEqualToAnchor:self.contentView.layoutMarginsGuide.leadingAnchor], [self.themeColorLabel.trailingAnchor constraintEqualToAnchor:self.contentView.layoutMarginsGuide.trailingAnchor], [self.themeColorLabel.topAnchor constraintEqualToAnchor: self.contentView.layoutMarginsGuide.topAnchor], [self.themeColorLabel.bottomAnchor constraintEqualToAnchor: self.contentView.layoutMarginsGuide.bottomAnchor], // Selected Theme Color Label [self.selectedColorLabel.trailingAnchor constraintEqualToAnchor: self.contentView.layoutMarginsGuide.trailingAnchor], [self.selectedColorLabel.topAnchor constraintEqualToAnchor: self.contentView.layoutMarginsGuide.topAnchor], [self.selectedColorLabel.bottomAnchor constraintEqualToAnchor: self.contentView.layoutMarginsGuide.bottomAnchor], ]]; }
3
0
130
3w
AlarmKit only triggers a short vibration when the screen is on — bug or expected behavior?
I'm building an alarm app using the new AlarmKit introduced in iOS 26. The alarm works correctly when the device is locked, but when the screen is already on and unlocked, it only gives a single short vibration. I tested another app that also uses AlarmKit just to confirm, and it behaves the same way—only one short vibration if the display is awake, and the developer added a push notification as a workaround. The default iOS Clock app works properly in both situations (though when the screen is on, it uses the Dynamic Island interface). So I'm wondering: is this behavior a bug in AlarmKit, or is it intentional?
Topic: UI Frameworks SubTopic: General
0
0
38
3w
How to place scrollable header content above a Table in SwiftUI?
Hi everyone, I’m trying to reproduce the layout Apple Music uses for playlists, where there is header content above the table (artwork, title, buttons), and when you scroll, everything scrolls together—the header and table rows move as a single scrollable region. Here’s an example of what I’m trying to achieve: I’m using SwiftUI’s Table view and I haven’t found a clean way to place custom content above the table while keeping everything inside the same scroll view. Is there currently a recommended way to achieve Apple Music–style scrollable header + table content using SwiftUI? Thanks!
1
0
147
3w
Severe Delay When Tapping TextField/Searchable on iOS 18 (Real Device) — XPC “Reporter Disconnected” Loop Until Keyboard Appears
I’m running Xcode 26.1.1 (17B100) with deployment target iOS 18.0+, and I’m seeing a consistent and reproducible issue on real devices (iPhone 13 Pro, iPhone 15 Pro): Problem The first time the user taps into a TextField or a SwiftUI .searchable field after app launch, the app freezes for 30–45 seconds before the keyboard appears. During the freeze, the device console floods with: XPC connection interrupted Reporter disconnected. { function=sendMessage, reporterID=XXXXXXXXXXXX } -[RTIInputSystemClient remoteTextInputSessionWithID:performInputOperation:] perform input operation requires a valid sessionID. inputModality = Keyboard customInfoType = UIEmojiSearchOperations After the keyboard finally appears once, the issue never happens again until the app is force-quit. This occurs on device Reproduction Steps Minimal reproducible setup: Create a new SwiftUI app. Add a single TextField or .searchable modifier. Install Firebase (Firestore or Analytics is enough). Build and run on device. Tap the text field immediately after the home screen appears. Result: App freezes for 30–45 seconds before keyboard appears, with continuous XPC/RTIInputSystem errors in the logs. If Firebase is removed, the issue occurs less often, but still happens occasionally. Even If Firebase initialization is delayed by ~0.5 seconds, the issue is still there. Question Is this a known issue with iOS 18 / RTIInputSystem / Xcode 26.1.1, and is there a recommended workaround? Delaying Firebase initialization avoids the freeze, but this isn’t ideal for production apps with startup authentication requirements. Any guidance or confirmation would be appreciated.
Topic: UI Frameworks SubTopic: SwiftUI
1
0
91
3w
Problem with buildMenuWithBuilder and scenes
Bonjour, I have an (old) app. written in Objective-C which works fine under iPadOS 26 with custom menus and contextual menus but without scenedelegate. To be able to have multi-windows, I added scenedelegate but "buildMenuWithBuilder" is no more called. I asked AI Claude and tried many solutions but none worked. Has anyone else had and solved this problem? Thanks.
Topic: UI Frameworks SubTopic: General
0
0
129
3w
Switching to custom keyboard size glitches
I've created a custom keyboard and implemented the: class KeyboardViewController: UIInputViewController The imlementation looks like this: override func viewDidLoad() { super.viewDidLoad() var stack = UIStackView() stack.axis = .vertical stack.spacing = 8 stack.translatesAutoresizingMaskIntoConstraints = false stack.distribution = .fill stack.heightAnchor.constraint(equalToConstant: 200).isActive = true .... view.addSubview(stack) NSLayoutConstraint.activate([ stack.leadingAnchor.constraint(equalTo: view.leadingAnchor, constant: 20), stack.trailingAnchor.constraint(equalTo: view.trailingAnchor, constant: -20), stack.topAnchor.constraint(equalTo: view.topAnchor, constant: 10), stack.bottomAnchor.constraint(equalTo: view.bottomAnchor, constant: -10) ]) The problem is that the keyboard seems to start showing in the size (I've printed the parent frame): Optional(<UIView: 0x101008480; frame = (0 0; 390 844); autoresize = W+H; layer = <CALayer: 0x600000207b80>>) and than resizes to my given height. But it's not fast enough so that I can see some glitches whenever I switch from another keyboard to my custom keyboard. Is there a way to prevent this resizing or start the keyboard in a given size? This is just not the best user experience.
Topic: UI Frameworks SubTopic: UIKit
0
1
141
4w
NSTextField behaviour out of control....
In a modal dialog, when tabbing to next NSTextField, or programmatically selecting a NSTextField, the NSTextfField that is loosing focus (aka resigning FirstResponder) appears empty in Tahoe 26 ( aka not displaying its content) . The same thing works oK in all systems before Tahoe. Found no workaround this issue which looks to be a Tahoe problem. i have a small app that demonstrate the issue.. but cannot be posted here due to zip format not accepted... i appreciate any help or apple engineer attention to that issue also posted with Evaluation Assistant under #FB21102969 ThX
0
0
79
4w
How to implement NFC Reader in SwiftUI?
Hi, does anyone know how to enable creating or configuring Near NFC Reader in SwiftUI? I've already added the capability, the permissions in info.plist, the entitlement, and the SwiftUI code, but without success. Here's the example code: class PaymentT2PViewModel: NSObject, ObservableObject { @Published var paymentT2PUIState: PaymentT2PUIState // MARK: - NFC Properties @Published var nfcMessage: String = .empty @Published var isNFCReading: Bool = false private var nfcSession: NFCTagReaderSession? init(paymentT2PUIState: PaymentT2PUIState) { self.paymentT2PUIState = paymentT2PUIState super.init() ) } func startNFCReading() { print("INICIO: startNFCReading llamado") guard NFCTagReaderSession.readingAvailable else { print("ERROR: NFC NO disponible en este dispositivo") Task { @MainActor in self.nfcMessage = "NFC no disponible en este dispositivo" } return } print("NFC disponible, creando sesión...") nfcSession = NFCTagReaderSession( pollingOption: [.iso14443, .iso15693, .iso18092], delegate: self, queue: nil ) print("Sesión creada, configurando mensaje...") nfcSession?.alertMessage = "Acerca la tarjeta al iPhone" nfcSession?.begin() print("Sesión NFC INICIADA - debería aparecer popup") Task { @MainActor in self.isNFCReading = true } } func stopNFCReading() { nfcSession?.invalidate() Task { @MainActor in self.isNFCReading = false } } extension PaymentT2PViewModel: NFCTagReaderSessionDelegate { func tagReaderSession(_ session: NFCTagReaderSession, didInvalidateWithError error: Error) { print("SESIÓN INVALIDADA") print("Error: (error.localizedDescription)") if let readerError = error as? NFCReaderError { print("Código de error: \(readerError.code.rawValue)") print("¿Es cancelación del usuario?: \(readerError.code == .readerSessionInvalidationErrorUserCanceled)") } Task { @MainActor in if let readerError = error as? NFCReaderError { if readerError.code != .readerSessionInvalidationErrorUserCanceled { self.nfcMessage = "Error: \(readerError.localizedDescription)" } } self.isNFCReading = false } } func tagReaderSessionDidBecomeActive(_ session: NFCTagReaderSession) { print("NFC Session activa") } func tagReaderSession(_ session: NFCTagReaderSession, didDetect tags: [NFCTag]) { guard let firstTag = tags.first else { return } session.connect(to: firstTag) { [weak self] error in if let error = error { session.invalidate(errorMessage: "Error al conectar: \(error.localizedDescription)") return } Task { @MainActor [weak self] in await self?.handleTag(firstTag, session: session) } } } private func handleTag(_ tag: NFCTag, session: NFCTagReaderSession) async { switch tag { case .iso7816(let tag): await handleISO7816Tag(tag, session: session) case .miFare(let tag): await handleMiFareTag(tag, session: session) case .iso15693(let tag): await handleISO15693Tag(tag, session: session) case .feliCa(let tag): await handleFeliCaTag(tag, session: session) @unknown default: session.invalidate(errorMessage: "Tipo de tag no soportado") } } private func handleISO7816Tag(_ tag: NFCISO7816Tag, session: NFCTagReaderSession) async { let uid = tag.identifier.map { String(format: "%02X", $0) }.joined() nfcMessage = """ ISO7816 Tag detectado UID: \(uid) Historical Bytes: \(tag.historicalBytes?.map { String(format: "%02X", $0) }.joined() ?? "N/A") """ session.alertMessage = "Tag leído exitosamente" session.invalidate() } private func handleMiFareTag(_ tag: NFCMiFareTag, session: NFCTagReaderSession) async { let uid = tag.identifier.map { String(format: "%02X", $0) }.joined() nfcMessage = """ MiFare Tag detectado UID: \(uid) Tipo: \(tag.mifareFamily.description) """ session.alertMessage = "Tag leído exitosamente" session.invalidate() } private func handleISO15693Tag(_ tag: NFCISO15693Tag, session: NFCTagReaderSession) async { let uid = tag.identifier.map { String(format: "%02X", $0) }.joined() nfcMessage = """ ISO15693 Tag detectado UID: \(uid) IC Manufacturer: \(tag.icManufacturerCode) """ session.alertMessage = "Tag leído exitosamente" session.invalidate() } private func handleFeliCaTag(_ tag: NFCFeliCaTag, session: NFCTagReaderSession) async { let idm = tag.currentIDm.map { String(format: "%02X", $0) }.joined() let pmm = tag.currentSystemCode.map { String(format: "%02X", $0) }.joined() nfcMessage = """ FeliCa Tag detectado IDm: \(idm) System Code: \(pmm) """ session.alertMessage = "Tag leído exitosamente" session.invalidate() } } // MARK: - Helper Extension extension NFCMiFareFamily { var description: String { switch self { case .unknown: return "Desconocido" case .ultralight: return "Ultralight" case .plus: return "Plus" case .desfire: return "DESFire" @unknown default: return "Otro" } } } struct PaymentT2PView: View { @ObservedObject var paymentT2PViewModel: PaymentT2PViewModel var body: some View { ZStack { if paymentT2PViewModel.paymentT2PUIState.showingResult { print("Navigate") } else { print("False") } } .onAppear { paymentT2PViewModel.startNFCReading() } .onDisappear { paymentT2PViewModel.stopNFCReading() } }} However, I'm getting code error messages, and I'm testing this on an iPhone 11. What am I doing wrong?
0
0
246
4w
Unwanted animations appear on UIButton (iOS 26)
After the iOS 26 update, unwanted animations appear on UIButton. I'm using the attributedTitle property of UIButton.Configuration to change the button's text, and an animation appears after iOS 26. (It's unclear whether it's after iOS 26.0 or iOS 26.1, but it likely started with 26.1.) The peculiar thing is that the animation only starts appearing on buttons that have been pressed once. I tried using UIView.performWithoutAnimation and CATransaction's begin(), setDisableActions(true), commit(), but it didn't work. How should I solve this? Below is the code for changing the button's text. func updateTitle() { let keys = type.keys if keys.count == 1 { guard let key = keys.first else { return } if key.count == 1 { if Character(key).isLowercase { self.configuration?.attributedTitle = AttributedString(key, attributes: AttributeContainer([.font: UIFont.systemFont(ofSize: 24, weight: .regular), .foregroundColor: UIColor.label])) } else if Character(key).isUppercase { self.configuration?.attributedTitle = AttributedString(key, attributes: AttributeContainer([.font: UIFont.systemFont(ofSize: 22, weight: .regular), .foregroundColor: UIColor.label])) } else { self.configuration?.attributedTitle = AttributedString(key, attributes: AttributeContainer([.font: UIFont.systemFont(ofSize: 22, weight: .regular), .foregroundColor: UIColor.label])) } } else { self.configuration?.attributedTitle = AttributedString(key, attributes: AttributeContainer([.font: UIFont.systemFont(ofSize: 18, weight: .regular), .foregroundColor: UIColor.label])) } } else { let joined = keys.joined(separator: "") self.configuration?.attributedTitle = AttributedString(joined, attributes: AttributeContainer([.font: UIFont.systemFont(ofSize: 22, weight: .regular), .foregroundColor: UIColor.label])) } }
1
0
179
4w
Erratic numberPad keyboard behaviour on iPadOS26
Number keys on iPadOS 26 register incorrect/random characters, making numeric input unreliable across all applications. Affected Versions iPadOS 26.0 through 26.1 (build 23B85) Platform-specific: Only iPadOS (iPhone doesn't present the full on-screen keyboard) Reproduction Steps Open any app with a numeric text field (For example, Apple's Contacts) Tap numeric text field - a small number-only pad appears Dismiss this small numpad (tap outside or hit return) Tap the field again - full keyboard with numbers appears Type numbers on this full keyboard Result: Numbers register as random/incorrect characters Scope Affects numeric keyboard types (.numberPad, .decimalPad ) Reproducible in Apple's native apps (Contacts or any apps that has numeric TextField) Impact Critical: Users cannot reliably enter phone numbers, passwords, financial data, or any numeric input. Other findings Keyboard starts to register correct keys when switch from the full on-screen keyboard to alphabetic page, and then back to the page with numeric keys
1
1
190
4w
Tahoe/NSTextField ignores some properties
On Tahoe NSTextField (and NSTextFieldCell) appears to ignore backgroundColor, drawsBackground, isBezeled, bezelStyle and isBordered properties. Those worked on prior macOS, but not Tahoe. Is there a way to make those properties effective while targeting Tahoe? Note: a slight erratum: backgroundColor has an effect while the text field has first responder status, but the background area is an inset rectangle and I suspect that is a remnant feature and not by design.
Topic: UI Frameworks SubTopic: AppKit
1
0
83
4w