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

WebAuthenticationSession doesn't seem to do anything on macOS
I'm attempting to use WebAuthenticationSession from Authentication Services (https://developer.apple.com/documentation/authenticationservices/webauthenticationsession) in a SwiftUI app on macOS. According to the docs, it is supported since macOS 13.3 and I'm testing on 26. I'm deploying the same code to iOS as well, and it works there in a simulator, but I sometimes have to tap the button that triggers the authenticate(…) call more than once. I've attached a simplified and redacted version of the code below. It works on iOS, but on macOS the authenticate call never returns. There seems to be very little documentation and discussion about this API and I'm running out of ideas for getting this to work. Is this just a bug that Apple hasn't noticed? import SwiftUI import AuthenticationServices import Combine struct PreAuthView: View { @Binding var appState: AppState @Binding var credentials: Credentials? @Environment(\.webAuthenticationSession) private var webAuthenticationSession @State private var plist: String = "" func authenticate() async { guard var authUrl = URL(string: "REDACTED") else { return } guard var tokenUrl = URL(string: "REDACTED") else { return } let redirectUri = "REDACTED" let clientId = "REDACTED" let verifier = "REDACTED" let challenge = "REDACTED" authUrl.append(queryItems: [ .init(name: "response_type", value: "code"), .init(name: "client_id", value: clientId), .init(name: "redirect_uri", value: redirectUri), .init(name: "state", value: ""), .init(name: "code_challenge", value: challenge), .init(name: "code_challenge_method", value: "S256"), ]) let scheme = "wonderswitcher" do { print("Authenticating") let redirectUrl = try await webAuthenticationSession.authenticate( using: authUrl, callback: .https(host: "REDACTED", path: "REDACTED"), additionalHeaderFields: [:], ) print("Authenticated?") print(redirectUrl) let queryItems = URLComponents(string: redirectUrl.absoluteString)?.queryItems ?? [] let code = queryItems.filter({$0.name == "code"}).first?.value let session = URLSession(configuration: .ephemeral) tokenUrl.append(queryItems: [ .init(name: "grant_type", value: "authorization_code"), .init(name: "code", value: code), .init(name: "redirect_uri", value: redirectUri), .init(name: "code_verifier", value: verifier), .init(name: "client_id", value: clientId), ]) var request = URLRequest(url: tokenUrl) request.httpMethod = "POST" let response = try await session.data(for: request) print(response) } catch { return } } var body: some View { NavigationStack { VStack(alignment: .leading, spacing: 12) { Text("This is the pre-auth view.") HStack { Button("Log in") { Task { await authenticate() } } Spacer() } Spacer(minLength: 0) } .padding() .navigationTitle("Pre-Auth") } } } #Preview { PreAuthView(appState: .constant(.preAuth), credentials: .constant(nil)) }
Topic: UI Frameworks SubTopic: SwiftUI
3
0
66
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
3
0
269
3w
tabViewBottomAccessory in 26.1: View's @State is lost when switching tabs
Any view that is content for the tabViewBottomAccessory API fails to retain its state as of the last couple of 26.1 betas (and RC). The loss of state happens (at least) when the currently selected tab is switched (filed as FB20901325). Here's code to reproduce the issue: struct ContentView: View { @State private var selectedTab = TabSelection.one enum TabSelection: Hashable { case one, two } var body: some View { TabView(selection: $selectedTab) { Tab("One", systemImage: "1.circle", value: .one) { BugExplanationView() } Tab("Two", systemImage: "2.circle", value: .two) { BugExplanationView() } } .tabViewBottomAccessory { AccessoryView() } } } struct AccessoryView: View { @State private var counter = 0 // This guy's state gets lost (as of iOS 26.1) var body: some View { Stepper("Counter: \(counter)", value: $counter) .padding(.horizontal) } } struct BugExplanationView: View { var body: some View { ScrollView { VStack(alignment: .leading, spacing: 16) { Text("(1) Manipulate the counter state") Text("(2) Then switch tabs") Text("BUG: The counter state gets unexpectedly reset!") } .multilineTextAlignment(.leading) } } }
5
4
538
3w
tabViewBottomAccessory causes unstable view identity for views accessing Environment or State
Views placed inside tabViewBottomAccessory that access @Environment values or contain @State properties experience unstable identity, as shown by Self._printChanges(). The identity changes on every structural update to the TabView, even though the view's actual identity should remain stable. This causes unnecessary view recreation and breaks SwiftUI's expected identity and lifecycle behavior. Environment Xcode Version 26.2 (17C52) iOS 26.2 simulator and device struct ContentView: View { @State var showMoreTabs = true struct DemoTab: View { var body: some View { Text(String(describing: type(of: self))) } } var body: some View { TabView { Tab("Home", systemImage: "house") { DemoTab() } Tab("Alerts", systemImage: "bell") { DemoTab() } if showMoreTabs { TabSection("Categories") { Tab("Climate", systemImage: "fan") { DemoTab() } Tab("Lights", systemImage: "lightbulb") { DemoTab() } } } Tab("Settings", systemImage: "gear") { List { Toggle("Show more Tabs", isOn: $showMoreTabs) } } } .tabViewBottomAccessory { AccessoryView() } .task { while true { try? await Task.sleep(for: .seconds(5)) if Task.isCancelled { break } print("toggling showMoreTabs") showMoreTabs.toggle() } } .tabBarMinimizeBehavior(.onScrollDown) } } struct AccessoryView: View { var body: some View { HStack { EnvironmentAccess() WithState() Stateless() } } } struct EnvironmentAccess: View { @Environment(\.tabViewBottomAccessoryPlacement) var placement var body: some View { // FIXME: EnvironmentAccess: @self, @identity, _placement changed. // Identity should be stable let _ = Self._printChanges() Text(String(describing: type(of: self))) } } struct WithState: View { @State var int = Int.random(in: 0...100) var body: some View { // FIXME: WithState: @self, @identity, _id changed. // Identity should be stable let _ = Self._printChanges() Text(String(describing: type(of: self))) } } struct Stateless: View { var body: some View { // Works as expected: Stateless: @self changed. let _ = Self._printChanges() Text(String(describing: type(of: self))) } } This bug seems to make accessing TabViewBottomAccessoryPlacement impossible without losing view identity; the demo code is affected by the bug. Accessing a value like @Environment(\.colorScheme) is similarly affected, making visually adapting the contents of the accessory to the TabView content without losing identity challenging if not impossible. Submitted as FB21627918.
0
0
53
3w
AsyncImage - Cancelled Loading before View is Visible
I have been playing around with the new AsyncImage Api in SwiftUI I am using the initialiser that passes in a closure with the AsyncImagePhase, to view why an image may not load, when I looked at the error that is passed in if the phase is failure, the localised description of the error is "Cancelled" but this is happening before the view is being displayed. I am loading these images in a list, I imagine I am probably doing something which is causing the system to decide to cancel the loading, but I cannot see what. Are there any tips to investigate this further?
16
8
13k
3w
Need a progress bar during init a document
I have no idea how to do it: on MacOS, in Document.init(configuration: ReadConfiguration) I decode file, and restore objects from data, which in some cases could take a long time. Document isn't fully inited, so I have no access to it. But would like to have a progress bar on screen (easier to wait for done, for now). I know size, progress value, but no idea how to make view from object during init. I know, this question may be very stupid. init(configuration: ReadConfiguration) throws { guard let data = configuration.file.regularFileContents else { throw CocoaError(.fileReadCorruptFile) } let decoder = JSONDecoder() let flat = try decoder.decode(FlatDoc.self, from: data) print ("reverting \(flat.objects.count) objects...") ///This takes time, a lot of time, need progress bar ///Total is `flat.objects.count`, current is `objects.count` /// `Show me a way to the (next) progress bar!` revertObjects(from: flat.objects) print ("...done") } update: I defined var flatObjects in Document, and I can convert in .onAppear. struct TestApp: App { @State var isLoading = false ... ContentView(document: file.$document) .onAppear { isLoading = true Task {file.document.revertObjects()} isLoading = false } if isLoading { ProgressView() } ... } But progress bar never shows, only rainbow ball
Topic: UI Frameworks SubTopic: SwiftUI Tags:
0
0
116
3w
Incorrect system color on popover view, and does not update while switching dark mode on iOS 26 beta 3
All system colors are displayed incorrectly on the popover view. Those are the same views present as a popover in light and dark mode. And those are the same views present as modal. And there is also a problem that when the popover is presented, switching to dark/light mode will not change the appearance. That affected all system apps. The following screenshot is already in dark mode. All those problem are occured on iOS 26 beta 3.
7
0
870
3w
Crash in UIKeyboardStateManager when repeatedly switching text input focus in WKWebView (hybrid app)
We’re building a hybrid iOS app using Angular (web) rendered inside a WKWebView, hosted by a native Swift app. Recently, we encountered a crash related to UIKeyboardStateManager in UIKit when switching between text inputs continuously within an Angular screen. Scenario The screen contains several text input fields. A “Next” button focuses the next input field programmatically. After about 61 continuous input field changes, the app crashes. It seems like this may be related to UIKit’s internal keyboard management while switching focus rapidly inside a WebView. crash stack: Crashed: com.apple.main-thread 0 WebKit 0xfbdad0 <redacted> + 236 1 UIKitCore 0x10b0548 -[UITextInteractionSelectableInputDelegate _moveToStartOfLine:withHistory:] + 96 2 UIKitCore 0xd0fb38 -[UIKBInputDelegateManager _moveToStartOfLine:withHistory:] + 188 3 UIKitCore 0xa16174 __158-[_UIKeyboardStateManager handleMoveCursorToStartOfLine:beforePublicKeyCommands:testOnly:savedHistory:force:canHandleSelectableInputDelegateCommand:keyEvent:]_block_invoke + 52 4 UIKitCore 0xa36ae4 -[_UIKeyboardStateManager performBlockWithTextInputChangesIgnoredForNonMacOS:] + 48 5 UIKitCore 0xa160f0 -[_UIKeyboardStateManager handleMoveCursorToStartOfLine:beforePublicKeyCommands:testOnly:savedHistory:force:canHandleSelectableInputDelegateCommand:keyEvent:] + 440 6 UIKitCore 0xa07010 -[_UIKeyboardStateManager handleKeyCommand:repeatOkay:options:] + 5760 7 UIKitCore 0xa2fb64 -[_UIKeyboardStateManager _handleKeyCommandCommon:options:] + 76 8 UIKitCore 0xa2fb08 -[_UIKeyboardStateManager _handleKeyCommand:] + 20 9 UIKitCore 0xa30684 -[_UIKeyboardStateManager handleKeyEvent:executionContext:] + 2464 10 UIKitCore 0xa2f95c __42-[_UIKeyboardStateManager handleKeyEvent:]_block_invoke + 40 11 UIKitCore 0x4b9460 -[UIKeyboardTaskEntry execute:] + 208 12 UIKitCore 0x4b92f4 -[UIKeyboardTaskQueue continueExecutionOnMainThread] + 356 13 UIKitCore 0x4b8be0 -[UIKeyboardTaskQueue addTask:breadcrumb:] + 120 14 UIKitCore 0x4a9ed0 -[_UIKeyboardStateManager _setupDelegate:delegateSame:hardwareKeyboardStateChanged:endingInputSessionIdentifier:force:delayEndInputSession:] + 3388 15 UIKitCore 0xfa290 -[_UIKeyboardStateManager setDelegate:force:delayEndInputSession:] + 628 16 UIKitCore 0xf617c -[UIKeyboardSceneDelegate _reloadInputViewsForKeyWindowSceneResponder:force:fromBecomeFirstResponder:] + 1140 17 UIKitCore 0xf5c88 -[UIKeyboardSceneDelegate _reloadInputViewsForResponder:force:fromBecomeFirstResponder:] + 88 18 UIKitCore 0x4fe4ac -[UIResponder(UIResponderInputViewAdditions) reloadInputViews] + 84 19 WebKit 0xfbe708 <redacted> + 100 20 WebKit 0xfbf594 <redacted> + 340 21 WebKit 0x8a33d8 <redacted> + 32 22 WebKit 0x8cee04 <redacted> + 144 23 WebKit 0x1c83f0 <redacted> + 22692 24 WebKit 0x73f40 <redacted> + 264 25 WebKit 0x162c7c <redacted> + 40 26 WebKit 0x1623b4 <redacted> + 1608 27 WebKit 0x73298 <redacted> + 268 28 WebKit 0x72e48 <redacted> + 660 29 JavaScriptCore 0xdb00 WTF::RunLoop::performWork() + 524 30 JavaScriptCore 0xd744 WTF::RunLoop::performWork(void*) + 36 31 CoreFoundation 0xf92c __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 28 32 CoreFoundation 0xf744 __CFRunLoopDoSource0 + 172 33 CoreFoundation 0xf5a0 __CFRunLoopDoSources0 + 232 34 CoreFoundation 0xff20 __CFRunLoopRun + 840 35 CoreFoundation 0x11adc CFRunLoopRunSpecific + 572 36 GraphicsServices 0x1454 GSEventRunModal + 168 37 UIKitCore 0x135274 -[UIApplication _run] + 816 38 UIKitCore 0x100a28 UIApplicationMain + 336 39 APP1 0xa2ed0 main + 21 (AppDelegate.swift:21) 40 ??? 0x1aa889f08 (シンボルが不足しています) From reviewing the crash log, it appears that the crash occurs inside UIKeyboardStateManager while handling keyboard or cursor updates. Questions Has anyone seen this specific crash pattern involving UIKeyboardStateManager? Are there known UIKit or WebKit bugs related to UIKeyboardStateManager when continuously changing focus between text fields (especially in WKWebView)? Any insights or workarounds would be greatly appreciated. Thanks!
1
0
219
3w
Table bug when row is selected and reorder is animated
Do you know if there is a work around to animate the reorder of a table without generating ghost rows? here is the code: var id = UUID() var name: String var value: Int } struct ContentView: View { @State var selectedNumber: UUID? @State var sortedBy: [KeyPathComparator<MyNumbers>] = [KeyPathComparator(\.name, order: .reverse)] @State var numbers: [MyNumbers] = { var numbersArray = [MyNumbers]() for i in 0..<100 { numbersArray.append(MyNumbers(name: "\(i)", value: i)) } return numbersArray }() var body: some View { Table(numbers, selection: $selectedNumber, sortOrder: $sortedBy) { TableColumn("names", value: \.name){ number in Text(number.name) } TableColumn("names", value: \.name){ number in Text(number.name) } }.onChange(of: sortedBy) { oldValue, newValue in withAnimation { numbers.sort(using: newValue) } } } } it generates ghost rows when the top row is selected and reorders twice, as you can see in the screenshot, the first six rows has two labels overlapped.
Topic: UI Frameworks SubTopic: SwiftUI
0
0
78
3w
https://stackoverflow.com/questions/79865253/watchos-swiftui-ui-redraws-are-delayed-in-always-on-power-saving-mode-despite
I'm working on a watchOS app using SwiftUI that updates its UI based on regular, time-driven logic. On a real Apple Watch, after the app has been running for ~1 minute, the device enters Always-On / power-saving display mode (screen dimmed, wrist down). From that point on, SwiftUI UI updates become noticeably delayed. The underlying logic continues to run correctly, but the UI only redraws sporadically and often "catches up" once the screen becomes fully active again. The app is running in workout mode, which keeps it alive and maintains WatchConnectivity, but this does not prevent UI redraw throttling. Below is a minimal reproducible example that demonstrates the issue. PlaybackModel.swift import SwiftUI @MainActor final class PlaybackModel: ObservableObject { @Published var beat: Int = 0 private var timer: Timer? func start() { timer?.invalidate() timer = Timer.scheduledTimer(withTimeInterval: 0.5, repeats: true) { _ in Task { @MainActor in self.beat += 1 } } } func stop() { timer?.invalidate() } } ContentView.swift (watchOS) import SwiftUI struct ContentView: View { @StateObject private var model = PlaybackModel() var body: some View { VStack { Text("Beat: \(model.beat)") .font(.largeTitle) } .onAppear { model.start() } .onDisappear { model.stop() } } } Observed Behavior • The beat value continues to increase reliably. • After the watch enters Always-On / power-saving mode, SwiftUI redraws are delayed or skipped. • When the screen becomes fully active again, the UI catches up. Questions: • Is this UI redraw throttling in Always-On / power-saving mode an unavoidable system limitation on watchOS? • Is there any supported way to keep consistent SwiftUI update frequency while the app is visible but dimmed?
1
0
90
3w
macOS SwiftUI Sheets are no longer resizable (Xcode 16 beta2)
For whatever reason SwiftUI sheets don't seem to be resizable anymore. The exact same code/project produces resizable Sheets in XCode 15.4 but unresizable ones with Swift included in Xcode 16 beta 2. Tried explicitly providing .fixedSize(horizontal false, vertical: false) everywhere humanly possible hoping for a fix but sheets are still stuck at an awkward size (turns out be the minWidth/minHeight if I provide in .frame).
7
1
2.7k
3w
iOS 26.1 PHPickerConfiguration.preselectedAssetIdentifiers doesn't select previous pictures in the PHPickerViewController
Hi, I faced with the issue on iOS 26.1 with PHPickerViewController. After first selection I save assetIdentifier of PHPickerResult for images. next time I open the picker I expect to have the images selected based on assetIdentifier Code: var config = PHPickerConfiguration(photoLibrary: .shared()) config.selectionLimit = 10 config.filter = .images config.preselectedAssetIdentifiers = images.compactMap(\.assetID) let picker = PHPickerViewController(configuration: config) picker.delegate = self present(picker, animated: true) But on iOS 26.1 they aren't selected. On lower iOS version all works fine. Does anybody faced with similar issue?
Topic: UI Frameworks SubTopic: UIKit
7
6
553
3w
Detecting marked range in UI/NSTextViews at the time of shouldChangeTextIn
We have submitted a feedback for this issue: FB21230723 We're building a note-taking app for iOS and macOS that uses both UITextView and NSTextView. When performing text input that involves a marked range (such as Japanese input) in a UITextView or NSTextView with a UITextViewDelegate or NSTextViewDelegate set, the text view's marked range (markedTextRange / markedRange()) has not yet been updated at the moment when shouldChangeTextIn is invoked. UITextViewDelegate.textView(_:shouldChangeTextIn:replacementText:) NSTextViewDelegate.textView(_:shouldChangeTextIn:replacementString:) The current behavior is this when entering text in Japanese: (same for NSTextView) func textView(_ textView: UITextView, shouldChangeTextIn range: NSRange, replacementText text: String) -> Bool { print(textView.markedTextRange != nil) // prints out false DispatchQueue.main.async { print(textView.markedTextRange != nil) // prints out true } } However, we need the value of markedTextRange right away in order to determine whether to return true or false from this method. Is there any workaround for this issue?
6
0
438
3w
The banner cannot be displayed correctly using 'LiveCommunicationKit'.
Since Callkit is not supported in mainland China, 'LiveCommunicationKit' is currently being used. When a VoIP push notification is received, the banner does not display correctly, but the phone icon in the top left corner, the ringtone, and vibration are present. I followed the solution in "https://developer.apple.com/forums/thread/774958?answerId=827083022#827083022" to resolve the crash issue, but the banner is still not displayed.
Topic: UI Frameworks SubTopic: General
0
0
55
3w
Changing the menu bar display name
Hello, I'm currently working on an app that will have a different name (and UI) depending on an environment variable that is set by that app's custom installer that I also wrote. I'm trying to change the app name that is displayed in the menu bar (top left) programmatically. I've done some research and found that it's probably not possible to do so because it's fetched from the app's Info.plist The answer is probably already there but I'll ask the question: Is it possible to change the app's name in the menu bar without tampering with the Info.plist (as it will break the signature at runtime, and it can't be done at compile time) The use case here is that I'm shipping a single app with multiple installers, because the app will be the same for all sets of users but it will have minor UI changes (which in my opinion, don't need an entire separate release), the installers will set a flag that the app will, based on, change its UI to the corresponding set of users. For the most part it's been successful but only small issue remain like this one. The reason it's done like that is when updating I'll ship 1 release for all users to update rather than having to ship multiple releases with no difference between them
1
0
102
3w
ios26 NumberPad keyboard issue on iPad
On an iPad running iOS26, there is an issue with the numberPad keyboard I have a UITextField with a keyboard type of .numberPad When I first tap in the field, a new number pad with just numbers (similar to the one that shows up on iPhone) shows up. When I tap again in the field, that number pad goes away. When I tap in the field again, the full keyboard with numbers etc shows up (this is the one that used to always show up pre-iOS26)
Topic: UI Frameworks SubTopic: UIKit
6
2
722
3w
CarPlay CPGridTemplate corrupt items
For some reason, Carplay 18.x works fine, however in under certain situations in our app, Carplay 26.x breaks. The expected grid layout should be : However, this is what we see in some cases when we update our templates. I have not been able to isolate the cause of this issue. Has anyone ever seen this happen on their CarPlay apps and discovered the cause? The data sets fed into the templates are identical, the difference is in some of the timing and update order...
0
0
86
3w
iPadOS 26.3 Beta 1 RequiresFullScreen Deprecation
Hello everyone, I have an app that is used in the education sector for high stakes assessment testing. I reviewed a lot of the WWDC2025 information in June, however, it seems we missed something critical in the What's new in UIKIt presentation. That would be the deprecation of UIRequiresFullScreen. We currently use this in our app and have been using it since iOS/iPad OS 9 when our app was written. The deprecation of this property has caused some major issues in our layout. Keep in mind we are a hybrid app so our mobile app is self-hosting a fullscreen version of WKWebView under the hood. This is common across assessment developers in the education sector. I removed the property and went through the migration guide (https://developer.apple.com/documentation/technotes/tn3192-migrating-your-app-from-the-deprecated-uirequiresfullscreen-key) and it doesn't appear to be straight forward on how to lock the orientation in landscape. I tried several different approaches: Requesting the screen orientation lock we had issues where if a user launched it in portrait it would be locked to portrait but we would want to update the display to shift it to landscape as a business requirement supporting both landscape right and landscape left. We also tried overriding the method supportedInterfaceOrientations and utilizing the .landscape enum with no success. It fires just fine but nothing takes effect. Backwards compatibility support there is no guidance on backwards compatibility support and Xcode wants us to do an availability check when using some of the new methods for updating geometry. What is the guidance in this case because we support back to iPadOS 16.0 as a business requirement. Can anyone give us some insight as we are current trying to get ahead of this while 26.3 is still in beta as this would affect our customers deeply because of the UI jank we get as a result of this deprecation.
1
0
171
3w