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

Can pressesBegan be used to simulate text input in a UITextView?
Hi, I’m working with custom text input handling in a UITextView. For simulating user typing programmatically, the documented way is to call: textView.insertText("H") This correctly inserts text, triggers delegate callbacks, updates the caret, and behaves as expected. However, since physical keyboard input normally goes through pressesBegan(:with:) before being translated into insertText(:), I was wondering: Is it possible (or supported) to call pressesBegan ourselves with a constructed UIPress/UIKey to simulate key input events in the same way the system does? Or Is the intended approach strictly to use insertText(_:) for simulating text entry, and pressesBegan should only ever be used for listening to actual hardware key presses? Thanks!
Topic: UI Frameworks SubTopic: UIKit
0
0
54
1w
UIKit.ButtonBarButtonVisualProvider not key value coding-compliant for the key _titleButton
After updating to Xcode 26 my XCUITests are now failing as during execution exceptions are being raised and caught by my catch all breakpoint These exceptions are only raised during testing, and seem to be referencing some private internal property. It happens when trying to tap a button based off an accessibilityIdentifier e.g. accessibilityIdentifier = "tertiary-button" ... ... app.buttons["tertiary-button"].tap() The full error is: Thread 1: "[<UIKit.ButtonBarButtonVisualProvider 0x600003b4aa00> valueForUndefinedKey:]: this class is not key value coding-compliant for the key _titleButton." Anyone found any workarounds or solutions? I need to get my tests running on the liquid glass UI
0
1
68
1w
SwiftUI DocumentGroup blocks "Create Document" button when opening a document in conflict state
In a SwiftUI DocumentGroup, the "Create Document" button remains permanently disabled when attempting to open a document that is in a conflict state (e.g., due to simultaneous edits across devices). As a result, the user cannot create new documents, and the app becomes stuck. On macOS, the expected conflict resolution dialog appears, and the app continues to function normally. On iOS, however, the "Create Document" button stays disabled indefinitely. This behavior occurs consistently in a default SwiftUI document-based app. Steps to Reproduce: Create a new SwiftUI document-based project in Xcode; Setup iCloud Storage in Signing & Capabilities; Create an empty document and place it in a conflict state (e.g., save it simultaneously from two devices); Attempt to open the conflicted document on an iPhone or iPad; Expected Result: The user should be able to resolve the conflict and continue working; The "Create Document" button should remain functional; Actual Result: The "Create Document" button is disabled permanently; The app cannot create new documents until restarted; Environment; iOS 18, iOS 26 (latest tested); Xcode Version 16.4 (16F6) Reproduced on iPhone and iPad; Works as expected on macOS; This appears to be a blocking issue in SwiftUI’s DocumentGroup on iOS. FB20203775
0
0
75
1w
iOS 26 Toolbar with UITabAccessory(UITabbarController.bottomAccessory)
Hi, When pushing a view controller with a toolbar onto a UITabBarController that has a bottom accessory, the toolbar and bottom accessory overlap. UITabbarController has a bottomAccessory AViewController push BViewController. And BViewController.hidesBottomBarWhenPushed = true Xcode version : Xcode 26.0 Release Cantidate sample code let flexible = if #available(iOS 26.0, *) { UIBarButtonItem(barButtonSystemItem: .fixedSpace, target: nil, action: nil) } else { UIBarButtonItem(barButtonSystemItem: .flexibleSpace, target: nil, action: nil) } let isMemo = isMemo let emailItem = UIBarButtonItem(image: UIImage(named: "batch_gray_email.png"), style: .plain, target: self, action: #selector(onEmailTapped)) let deleteItem = UIBarButtonItem(image: UIImage(named: "batch_gray_bin.png"), style: .plain, target: self, action: #selector(onDeleteTapped)) deleteItem.tintColor = .systemRed let editItem = UIBarButtonItem(image: UIImage(named: "batch_gray_compose.png"), style: .plain, target: self, action: #selector(onEditTapped)) let memoItem = UIBarButtonItem(image: UIImage(named: "batch_note.png"), style: .plain, target: self, action: #selector(onMemoTapped)) if isMemo { setToolbarItems([flexible, deleteItem, flexible, memoItem, flexible], animated: true) } else { setToolbarItems([emailItem, flexible, deleteItem, flexible, editItem, flexible, memoItem], animated: true) } AViewController *detailViewController = [[AViewController alloc]init]; detailViewController.hidesBottomBarWhenPushed = YES; [self.navigationController pushViewController:detailViewController animated:true];
Topic: UI Frameworks SubTopic: UIKit Tags:
0
0
71
1w
Future: What happens to apps submitted with UIDesignRequiresCompatibility = YES without further updates?
I'm trying to understand how to best position my iOS apps in the event that—for whatever reason—I'm unable to release another version after submitting a version built with Xcode 26 that uses UIDesignRequiresCompatibility = YES. For the sake of this discussion, assume that my apps require updates for proper UI presentation with the Liquid Glass UI, and that I'm submitting an initial version with UIDesignRequiresCompatibility = YES. I need to make an initial update for iOS 26 right away, because running the app linked with the iOS 18.x SDK (as currently shipping on the App Store) on iOS 26 introduces UI usability problems. Now, I have actually revised the UI for Liquid Glass and this requires slightly different behaviors for the legacy UI path (iOS 18.6 or iOS 26.0 with UIDesignRequiresCompatibility = YES) versus Liquid Glass UI path. My Liquid Glass adoption UI may be "good enough," and it's certainly better than the results obtained when rebuilding with Xcode 26 and running without any updates at all (which produces a very poor, if not unusable, user experience), but I am not satisfied with these updates at present and I hope to make additional improvements before enabling the revised UI for users. However, in the event that I cannot make another update for whatever reason, I need to ensure that users will never be exposed to the UI behavior that results from running with UIDesignRequiresCompatibility = NO with the code supporting Liquid Glass adoption disabled. As long as Apple will guarantee going forward that an app built with Xcode/iOS 26.0 SDK including UIDesignRequiresCompatibility = YES in its plist will always use the old rendering mode in any future OS, then perhaps everything is fine. However, if that's not the case, then I think I need some way to detect the enablement state of the new Liquid Glass UI at runtime (which goes beyond a simple @available check, e.g. iOS 26+ with "compatibility mode" disabled) so that I can provision to have my code supporting Liquid Glass adoption be automatically enabled in the event that my app never receives another update and a future OS ignores the UIDesignRequiresCompatibility key in its plist. I'm assuming that testing the value of the key in the plist at runtime would be insufficient, since it would still be present but ignored. This sort of continuity planning seems like something that many developers would be concerned about. What is Apple's guidance on this? So far I haven't found any clear discussion of this concern. Note: My app is UIKit-based, mostly Objective-C with a bit of Swift only for TipKit.
Topic: UI Frameworks SubTopic: UIKit Tags:
0
0
116
1w
React Native/Expo App Shows White Screen in Production Builds - Works Fine in Development
Hello Apple Developer Community, I'm experiencing a persistent issue with my React Native/Expo app that I've been trying to resolve for weeks. I'm hoping someone here has encountered and solved this problem. The Problem: • My app works perfectly in development (Expo Go, local builds, simulators) • When built for production and installed via TestFlight, it shows only a white screen • The app launches successfully (no crashes) but never renders any UI • This happens consistently across multiple builds and attempts Technical Details: • Framework: React Native 0.79.5 with Expo SDK 53 • Backend: Supabase • Navigation: React Navigation What I've Tried: ✅ Created missing .env file with environment variables ✅ Installed missing peer dependencies (expo-font) ✅ Ran npx expo-doctor - all checks pass ✅ Added error boundaries and loading screens ✅ Incremented build numbers and rebuilt multiple times ✅ Verified Supabase credentials are correct ✅ Checked native iOS logs - app launches successfully, no crashes Key Observations: Works in Expo Go ✅ Works in development builds ✅ Fails in production builds ❌ No JavaScript errors visible in system logs App process runs stable (no crashes) Questions: • Has anyone encountered this specific issue with React Native/Expo production builds? • Are there known issues with Metro bundler in production builds? • Could this be related to JavaScript bundle loading in production? • Are there specific EAS Build configurations that might cause this? Repository: https://github.com/bigmoud/voluntr (if anyone wants to examine the code)
Topic: UI Frameworks SubTopic: General
1
0
15
1w
I need help
I am trying to learn to write swift. I am very proficient MS VB, which I have been using for almost 20 years. The Book I am learning from is: SwiftUI for Masterminds by J.D Gauchat. I have got to chapter 7 with no problem. The exercise I am having a problem with Listing 7-5. The error I am getting is: Thread 1: Fatal error: No Observable object of type ApplicationData found. A View.environmentObject(_:) for ApplicationData may be missing as an ancestor of this view. I have spent the last 2 days rechecking my code. The MacBook I am using was purchased in May this year, is 16 inch, Max 4 pro chip with 128 G Ram I am seeking help here as a last resort, I understand everybody is busy. The main issue I have with the book is the author assumes you know as much as he does. As I stated, I am very proficient MS VB Firstly Is the SwiftUI for Masterminds to advanced for? Secondly What is the best book to start with and then move on to SwiftUI for Masterminds. Thirdly I thank you for reading my first post here. Regards Terry Harrison
Topic: UI Frameworks SubTopic: SwiftUI
3
0
134
1w
iOS 26 RC: Scope button in stacked UISearchBar block touches
This is really odd. If you setup a UISearchController with a preferredSearchBarPlacement of .stacked and you setup the search bar with scope buttons, then when the view controller is initially displayed, the currently hidden scope buttons block touch events from reaching the main view just below the search bar. But once the search is activated and dismissed, then the freshly hidden scope buttons no longer cause an issue. This is easily demonstrated by putting a UITableViewController in a UINavigationController. Setup the table view to show a few simple rows. Then setup a search controller using the following code: func setupSearch() { // Setup a stacked search bar with scope buttons // Before the search is ever activated, the hidden scope buttons block any touches in the main view controller // in the area just below the search bar. // Once the search is activated and dismissed, the problem goes away. It seems that displaying and hiding the // scope buttons at least once fixes the issue that exists beforehand. // This issue only exists in iOS/iPadOS 26, not iOS/iPadOS 18 or earlier. let search = UISearchController(searchResultsController: UIViewController()) search.hidesNavigationBarDuringPresentation = true search.obscuresBackgroundDuringPresentation = true search.scopeBarActivation = .onSearchActivation // Ensure button appear immediately let searchBar = search.searchBar searchBar.scopeButtonTitles = [ "One", "Two", "Three" ] self.navigationItem.searchController = search self.navigationItem.hidesSearchBarWhenScrolling = false // Issue appears even if this is true self.navigationItem.preferredSearchBarPlacement = .stacked } When first shown, before any attempt is made to activate the search, any attempt to tap on the upper 2/3 of the first row in the table view (which is just below the search bar) fails. If you tap on the lower 1/3 of the first row it works fine. If you then activate the search (now the scope buttons appear) and then dismiss the search (now the scope buttons are hidden again), then there is no issue tapping anywhere on the first row of the table. But if you restart the app, the problem starts over again. This problem happens on any iPhone or iPad, real or simulated, running iOS/iPadOS 26 RC. This is a regression from iOS 18 or earlier.
1
1
106
1w
iOS 26 RC: Scope buttons never appear for integrated UISearchBar
When trying to use a UISearchController setup with a UISearchBar that has scope buttons, the search controller's scopeBarActivation property is set to .onSearchActivation, the navigation item's preferredSearchBarPlacement property is set to .integrated. or .integratedButton, and the search bar/button appears in the navigation bar, then the scope buttons never appear. But space is made for where they should appear. Some relevant code in a UIViewController shown as the root view controller of a UINavigationController: private func setupSearch() { let sc = UISearchController(searchResultsController: UIViewController()) sc.delegate = self sc.obscuresBackgroundDuringPresentation = true // Setup search bar with scope buttons let bar = sc.searchBar bar.scopeButtonTitles = [ "One", "Two", "Three", "Four" ] bar.selectedScopeButtonIndex = 0 bar.delegate = self // Apply the search controller to the nav bar navigationItem.searchController = sc // BUG - Under iOS/iPadOS 26 RC, using .onSearchActivation results in the scope buttons never appearing at all // when using integrated placement in the nav bar. // Ensure the scope buttons appear immediately upon activating the search controller sc.scopeBarActivation = .onSearchActivation // This works but doesn't show the scope buttons until the user starts typing - that's too late for my needs //sc.scopeBarActivation = .automatic if #available(iOS 26.0, *) { // Under iOS 26 put the search icon in the nav bar - same issue for .integrated and .integratedButton navigationItem.preferredSearchBarPlacement = .integrated // .integratedButton // My toolbar is full so I need the search in the navigation bar navigationItem.searchBarPlacementAllowsToolbarIntegration = false // Ensure it's in the nav bar } else { // Under iOS 18 put the search bar in the nav bar below the title navigationItem.preferredSearchBarPlacement = .stacked } } I need the search bar in the navigation bar since the toolbar is full. And I need the scope buttons to appear immediately upon search activation. This problem happens on any real or simulated iPhone or iPad running iOS/iPadOS 26 RC.
1
1
108
1w
Why does SwiftUI Text(date, style: .relative) show the same duration for different dates?
I’m using SwiftUI’s Text(_:style:) with the .relative style to show how long ago a date occurred. According to the docs: A style displaying a date as relative to now. I expected it to show the precise difference between a past date and the current date. However, I noticed that two dates that are 3 days apart both display the same relative string under certain conditions. Code snippet to reproduce- (using GMT time zone and the system calendar) IMPORTANT: To reproduce this, set your Mac’s system clock to 8 September 2025, 3:00 AM. SwiftUI’s relative style uses the current system time as its reference point, so changing the clock is necessary to see the behavior. Settings Mac is set to Central European Time zone (but this behaviour was also reproduced by one of my app's users in the US.) Mac OS Sequoia 15.5 XCode 16.4 tested on an iOS Simulator and a real iPhone both running iOS 18.5 struct TestDateView: View { var body: some View { // 8. July 10AM to 8. September 3AM = Shows 2 months 2 days let startDate1: Date = Calendar.current.date(from: .init(calendar: .current, timeZone: .gmt, year: 2025, month: 7, day: 8, hour: 10, minute: 0, second: 0))! // 5. July 10AM to 8. September 3AM = Shows 2 months 2 days let startDate2: Date = Calendar.current.date(from: .init(calendar: .current, timeZone: .gmt, year: 2025, month: 7, day: 5, hour: 10, minute: 0, second: 0))! // IMPORTANT!: Need to set MAC's clock to 8. September 3:00 AM to reproduce this bug VStack { Text(startDate1, style: .relative) Text(startDate2, style: .relative) } } } How exactly does the .relative style work internally? Is it expected that different dates can collapse into the same result like this, or is there a better way to use .relative to get more precise results? PS: I know about DateComponents and DateFormatter for exact calculations, but I’d like to understand this approach since it auto-updates natively with no timers or publishers.
0
0
76
1w
glassEffectUnion in UIKit ?
Hi, Is there any equivalent of glassEffectUnion in UIKit ? I would like to achieve the same effect as described here : https://developer.apple.com/documentation/SwiftUI/Applying-Liquid-Glass-to-custom-views
Topic: UI Frameworks SubTopic: UIKit
0
0
67
1w
iOS 26: Some of the UIToolbarItems in my Toolbar do not get rendered and their actions dont run when touched
In the RC canidate of iOS 26 I have notices sometimes my toolbar is not rendering one of the items, its a select button, The space is there as there is an oval on the screen but it does not have the label and does nothing when you touch it. Other UIToolbarItems in my toolbar are being displayed so i dont know why this one is having troubles. This however doesnt happen every time and instead it works I am not seeing anything in the console to indicate why this one button is not getting set correctly I should also mention this was not an issue with iOS 18 and we havent changed any code around how we set the toolbar Below is my code snippet
Topic: UI Frameworks SubTopic: UIKit
3
0
121
1w
NSToolbar Space item rendered with Liquid Glass Background
Hi, I have a NSToolbar in my Mac Catalyst app with a space and flexible space item in it (https://developer.apple.com/documentation/appkit/nstoolbaritem/identifier/space). On macOS Tahoe the space item is being rendered with a Liquid Glass effect and seems to be automatically grouped with the previous item. Is there a way to prevent this? It basically adds some undesired padding next to the previous item and looks add. The flexible space is rendered normally and as before. I am talking about the space right next to the back chevron item. Thanks for any hints!
1
0
89
1w
SwiftUI Slider will cause app to crash on macOS Tahoe RC
Hello, creating a simple-as-it-gets Slider in SwiftUI and then running that app on Mac Catalyst with the macOS idiom enabled, the app crashes: struct ContentView: View { @State private var sliderValue: Double = 0.4 var body: some View { VStack { Slider(value: $sliderValue) } .padding() } } running this will result in an exception: _setMinimumEnabledValue: is not supported on UISlider when running Catalyst apps in the Mac idiom. See UIBehavioralStyle for possible alternatives. This is obviously not ideal and also apparently no documented. Is there a workaround for this? It used to work for on macOS Sonoma. macOS 26 RC Xcode 26 RC FB20191635 Thanks!
2
2
200
1w
SwiftUI Table Header Background not appearing in iPadOS 26
Hi, it seems like using Table on iPadOS 26 results in the table header not applying a background. When comparing the same code on iPadOS 18, the table header applies a blur behind the header to ensure legibility when the user scrolls the content. Is there a way to ensure Table applies a background effect to the header so that content remains legible during scrolling? Here is a minimal example: struct TablePreviewContent: Identifiable { var id: Int { text.hashValue } var text: String } #Preview { let content = [TablePreviewContent(text: "Hello"), TablePreviewContent(text: "World")] Table(content) { TableColumn("Title", value: \.text) } } I've attached screenshots of the behavior on iPadOS 26 compared to iPadOS 18 to illustrate the issue.
3
0
96
1w
[UIKit, SwiftUI] Document-based app hangs when document initialization throws exception
Steps to reproduce: Create a default document-based app for iOS using SwiftUI or UIKit with UIDocumentViewController. In the document loading method, simulate an error by throwing an exception, for example: throw CocoaError(.coderValueNotFound) Open the app on device/simulator running iOS 18 and attempt to open or create a new document. Expected behavior: An appropriate error message should be displayed to the user. Actual behavior: No error message is shown to the user The "Create Document" button becomes permanently disabled The app appears to hang or become unresponsive Environment: iOS 18, 26 beta 9 Both UIKit and SwiftUI implementations affected Has anyone encountered this issue or found a workaround? This seems like a regression in iOS 18's document handling. FB20189617, FB20189669
0
0
93
1w
How to handle sequential key events with hotkey computation in UITextField (UIKit)
Hello, I am building a UIKit application where I need to handle key events in a UITextField with the following requirements: Normal key presses (e.g. A, B, etc.) should insert characters into the text field. A hotkey combination (Ctrl+K) should trigger a custom computation that runs on a background thread, and once completed, its result (e.g. $) should be inserted into the text field. All events (normal keys and hotkeys) must appear in the exact order they were pressed by the user. For example: If the user types A, B, then Ctrl+K, the field should show AB$. If the user types A, Ctrl+K, C, the field should show A$C, even if the computation for $ takes longer. I want strict sequential processing: no later keystroke should be inserted until an earlier hotkey computation finishes. I have tried overriding pressesBegan(_:with:) in a custom UITextField subclass, and I can detect both normal keys and Ctrl+K. Questions: Is there a recommended UIKit API or pattern for handling this kind of ordered key event processing with hotkeys? Are there best practices for mixing UI updates with background computations in this context, while preserving event order? Thanks!
Topic: UI Frameworks SubTopic: UIKit Tags:
0
0
64
1w
Is placeCursor(at:animated:) a public API for moving the text cursor?
Hi, I came across the following API: @MainActor func placeCursor(at position: UITextPosition!, animated: Bool) From the signature, it seems intended to move the insertion point (caret) to a given UITextPosition, with an option for animation. However, UITextView and UITextField don’t seem to expose this method as a public member — calling it gives the error: Value of type 'UITextView' has no member 'placeCursor' My questions are: Is placeCursor(at:animated:) a public, supported API that we can safely use in apps? If not, what is the Apple-recommended way to programmatically move the cursor without animation? Right now, I only know of updating selectedTextRange, which works but doesn’t involve this placeCursor method. I want to confirm if placeCursor is meant for developer use or is an internal/private API. Thanks!
Topic: UI Frameworks SubTopic: UIKit Tags:
0
0
62
1w
Encountered an issue when adding a highlight effect to an image with rounded corners.
When I display 2/3 of the poster on tvos, after setting it according to the code, some semi-transparent background can be seen in the upper left and right corners of the image when it is in focus. How can I eliminate it? struct HighPosterView: View { let media: MediaDetail @State private var isShowingDetails = false @Environment(\.isFocused) private var isFocused: Bool var body: some View { Button { isShowingDetails.toggle() } label: { HighShelfImageView(imageURL: media.posterURL) .contentShape(RoundedRectangle(cornerRadius: 24, style: .continuous)) .hoverEffect(.highlight) Text(media.displayTitle) .lineLimit(1) .font(.subheadline) .frame(maxWidth: 300) } .buttonStyle(.borderless) .animation(.smooth) } } struct HighShelfImageView: View { let imageURL: URL? var body: some View { KFImage.url(imageURL) .targetCache(ImageCacheManager.shelfCache) .setProcessor(ImageCacheManager.mediaListShelfProcessor) .placeholder { Color.primary.opacity(0.1) .cornerRadius(Constants.cornerRadius) } .cancelOnDisappear(true) .cacheMemoryOnly(false) .fade(duration: 0.1) .cacheOriginalImage(true) .resizable() .aspectRatio(2/3, contentMode: .fill) .clipShape(RoundedRectangle(cornerRadius: Constants.cornerRadius)) } } I need to keep the image and text distributed vertically, keep customize corner, with the text pushed aside when the image is in focus.
0
0
9
1w