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

how to custom DatePicker Label
I have a custom UI to display date (for user birthday) and want if the user presses each part of the label , the date selection is displayed, the current issue is , when I try to reduce the DatePicker opacity or set the colorMultipli to clear color, it still clickable on the date area, while my object is a fullWidth object, how can I fix it? This is the code: VStack(alignment: .leading, spacing: 8) { Text("Birthday") .font(.SFProText.font(type: .medium, size: 13)) .foregroundStyle(Color(uiColor: .label)) HStack(alignment: .center) { Text(userProfileAccountInfoviewModel.birthday.getShortFormat(format: "dd MMM yyyy")) .font(.SFProText.font(type: .medium, size: 13)) .foregroundColor(Color(uiColor: .label)) .padding(.horizontal, 13) Spacer() } .frame(height: 44) .contentShape(Rectangle()) .overlay { HStack { DatePicker(selection: $userProfileAccountInfoviewModel.birthday, displayedComponents: .date) {} .labelsHidden() .colorMultiply(.clear) .background(Color.clear) .foregroundStyle(Color.baseBackgroundSecondary) .frame(maxWidth: .infinity) .contentShape(Rectangle()) // .opacity(0.011) Spacer() } } .background(Color.baseBackgroundSecondary) .clipShape(RoundedRectangle(cornerRadius: 4)) }
1
0
247
1w
Wrong position of searchable component on first render
Hey all, I found a weird behaviour with the searchable component. I created a custom bottom nav bar (because I have custom design in my app) to switch between screens. On one screen I display a List component with the searchable component. Whenever I enter the search screen the first time, the searchable component is displayed at the bottom. This is wrong. It should be displayed at the top under the navigationTitle. When I enter the screen a second time, everything is correct. This behaviour can be reproduced on all iOS 26 versions on the simulator and on a physical device with debug and release build. On iOS 18 everything works fine. Steps to reproduce: Cold start of the app Click on Search TabBarIcon (searchable wrong location) Click on Home TabBarIcon Click on Search TabBarIcon (searchable correct location) Simple code example: import SwiftUI struct ContentView: View { @State var selectedTab: Page = Page.main var body: some View { NavigationStack { ZStack { VStack { switch selectedTab { case .main: MainView() case .search: SearchView() } } VStack { Spacer() VStack(spacing: 0) { HStack(spacing: 0) { TabBarIcon(iconName: "house", selected: selectedTab == .main, displayName: "Home") .onTapGesture { selectedTab = .main } TabBarIcon(iconName: "magnifyingglass", selected: selectedTab == .search, displayName: "Search") .onTapGesture { selectedTab = .search } } .frame(maxWidth: .infinity) .frame(height: 55) .background(Color.gray) } .ignoresSafeArea(.all, edges: .bottom) } } } } } struct TabBarIcon: View { let iconName: String let selected: Bool let displayName: String var body: some View { ZStack { VStack { Image(systemName: iconName) .resizable() .renderingMode(.template) .aspectRatio(contentMode: .fit) .foregroundColor(Color.black) .frame(width: 22, height: 22) Text(displayName) .font(Font.system(size: 10)) } } .frame(maxWidth: .infinity) } } enum Page { case main case search } struct MainView: View { var body: some View { VStack { Image(systemName: "globe") .imageScale(.large) .foregroundStyle(.tint) Text("Hello, world!") } .padding() .navigationTitle("Home") } } struct SearchView: View { @State private var searchText = "" let items = [ "Apple", "Banana", "Pear", "Strawberry", "Orange", "Peach", "Grape", "Mango" ] var filteredItems: [String] { if searchText.isEmpty { return items } else { return items.filter { $0.localizedCaseInsensitiveContains(searchText) } } } var body: some View { List(filteredItems, id: \.self) { item in Text(item) } .navigationTitle("Fruits") .searchable(text: $searchText, placement: .navigationBarDrawer(displayMode: .always), prompt: "Search") } }
0
0
58
1w
ASAuthorizationAccountCreationProvider does not work with 3rd party apps
hello im using the new IOS 26 api for passkey creation ASAuthorizationAccountCreationProvider however it only seems to work with apple's Passwords app. Selecting 3rd party password apps (1Password, google chrome, etc) does not create the passkey. The sign up sheet gives me the option to save in 3rd party apps, but when I select a 3rd party app, I just get the ASAuthorizationError cancelled error? So I dont even know what the problem is? When selecting "Save in Passwords(apple's app)" during the sign up it works fine Has anyone else run into this issue? Is there something I need to do enable 3rd party apps?
4
0
279
1w
UICollectionViewCell context menu is clipped when long-pressing a view using UIGlassEffect (iOS 26)
Description I am seeing inconsistent clipping behavior in UICollectionViewCell when presenting a context menu by long press on a subview that uses UIGlassEffect. Summary of behavior: Long-pressing a normal view inside a UICollectionViewCell presents the menu correctly (no clipping). Long-pressing a view wrapped in UIVisualEffectView using UIGlassEffect causes the sub-view with glass effect to be clipped at the cell’s bounds. clipsToBounds = false is set on: the cell the cell’s contentView This behavior is reproducible and appears to be specifically related to UIGlassEffect.
1
0
132
1w
How to set custom height for keyboard extension without resize flicker?
Description I'm developing a custom keyboard extension using UIInputViewController and need to set a specific height of 268 points. The keyboard functions correctly, but there's a visible flicker and resize animation during launch that I cannot eliminate. The Problem When the keyboard launches, iOS provides incorrect heights before settling on the correct one. At launch, the view starts at 0×0. Around 295ms later, iOS sets the frame to 440×956 which is full screen height and wrong. Around 373ms, iOS changes it to 440×452 which is still wrong. Finally around 390ms, iOS settles at 440×268 which matches our constraint. This causes visible flicker as the view resizes three times rapidly. The keyboard appears to shrink from full screen down to the correct height, and users can clearly see this animation happening. What I've Tried I've tried adding a height constraint on self.view which gives me the correct height but causes the visible flicker. I created a custom UIInputView subclass and overrode intrinsicContentSize to return my desired height. iOS completely ignores this and gives random heights like 471pt, 680pt, or 956pt instead. I set allowsSelfSizing to true on my UIInputView subclass. iOS ignores this property. I set preferredContentSize on the view controller. iOS ignores this as well. I tried adding the constraint in viewDidAppear instead of viewDidLoad, thinking iOS might have settled by then. It still causes flicker. I overrode the frame and bounds setters on my UIInputView to clamp the height to my desired value. iOS bypasses these overrides somehow. I overrode layoutSubviews to force the correct height after the super call. iOS still applies its own height. Specific Question What is the correct API or technique to specify a keyboard extension's height that iOS will respect immediately upon launch, without triggering the resize animation sequence? Other third-party keyboards like Grammarly and SwiftKey appear to have solved this problem. Their keyboards appear at the correct height without any visible flicker. How do they achieve this? Expected Outcome The keyboard should appear at 268pt height on the first frame with no visible resize animation. Steps to Reproduce Create a new iOS App project in Xcode and add a Keyboard Extension target. In KeyboardViewController.swift, add a height constraint in viewDidLoad: override func viewDidLoad() { super.viewDidLoad() let heightConstraint = view.heightAnchor.constraint(equalToConstant: 268) heightConstraint.priority = .defaultHigh heightConstraint.isActive = true let label = UILabel() label.text = "Demo Keyboard" label.textAlignment = .center label.translatesAutoresizingMaskIntoConstraints = false view.addSubview(label) NSLayoutConstraint.activate([ label.centerXAnchor.constraint(equalTo: view.centerXAnchor), label.centerYAnchor.constraint(equalTo: view.centerYAnchor) ]) } Build and run on a physical device. Enable the keyboard in Settings, then General, then Keyboard, then Keyboards. Open any app with a text field and switch to the custom keyboard using the globe button. Observe the height changing from around 956pt to 452pt to 268pt with visible animation. Environment iOS 17 and iOS 18 and 26.2, Xcode 16 and Xcode 26, affects all iPhone models tested, reproducible on both simulator and physical device.
0
2
82
1w
CarPlay on iOS 14 and iOS 15
My app developed with the new Xcode 26 doesn't appear on CarPlay when running on iOS 14–15 devices. My developer has obtained the com.apple.developer.carplay-driving-task permission, but iOS 16+ devices allow my app to display on CarPlay. Can anyone help resolve this issue? Is it because the carplay-driving-task permission is only available for iOS 16+ devices? If I want compatibility with iOS 14–15 devices, do I need to apply to Apple for the carplay-audio permission to use it? Has anyone encountered a similar issue? Thanks!
1
0
81
1w
Autofill Creditcard
We have a native iOS app built with UIKit, and we are experiencing issues with credit card autofill when using the keyboard Quick Type bar. We have reviewed the documentation on Associated Domains, but we haven’t found anything that specifically addresses our issue. Our goal is to autofill all credit card details-including the CVV-in a single step, rather than one field at a time
1
0
43
1w
Cannot see appended AttributedString in NSTextView
When I appendAttributedString to [textView textStorage] it does not appear on the scrollable TextView. However when I NSLog the [textView textStorage] the Attributed string is outputted, and is therefore stored in the textView, see below. Occurs every time I ask to see the AttributedString I send to the textView. [textView textStorage] attributedString I need to see the attributedString displayed on the ScrollableTextView, but I don't know why I cannot see it.
2
0
382
1w
Animation Help
Hello, I am trying to use matchedGeometryEffect to animate between an item in a list view and the item's detail view. Right now, I am getting an unwanted cross-fade animation as the view transitions. So the list item moves into place as it should with the modifier, but it fades out as its detail version fades in, which I do not want. I do not want any fading at all, just the movement from one component to the other. How do I stop this? Thanks.
2
0
66
1w
UIKit equivalent of SwiftUI .tabRole(.search)?
In SwiftUI, iOS 18+ provides a dedicated Search tab role: Tab(value: .search, role: .search) { Text("This view is intentionally blank") } This displays Search as a separate tab bar item/slot. Is there an official UIKit equivalent for UITabBarController / UITabBarItem? If not, what is Apple’s recommended UIKit approach to achieve the same UX?
Topic: UI Frameworks SubTopic: UIKit
1
0
124
1w
SwiftUI view state resetting after alert is shown
Seeing an issue in iOS 26.2 iPhone 17 simulator (haven't been able to reproduce on device or other simulators), where a view's state is reset after an alert is shown. In this example the first LibraryView has the issue when alert is shown, the second LibraryView maintains state as expected. struct ContentView: View { var body: some View { NavigationStack { List { VStack { LibraryView(title: "Show view (Loss of state)") } LibraryView(title: "Show view (Works as expected)") } } } } /// This view is from a package dependency and wants to control the presentation of the sheet internally public struct LibraryView: View { @State private var isPresented: Bool = false let title: String public init(title: String) { self.title = title } public var body: some View { Button(self.title) { self.isPresented = true } .sheet(isPresented: self.$isPresented) { ViewWithAlert() } } } private struct ViewWithAlert: View { @State private var isPresented: Bool = false @State private var presentedCount = 0 var body: some View { Button("Show Alert, count: \(presentedCount)") { isPresented = true presentedCount += 1 } .alert("Hello", isPresented: self.$isPresented) { Button("OK") { } } } } Any ideas? The issue can be corrected by moving the .sheet to a higher level within the layout (i.e. on the NavigationStack). However, the library wants to control that presentation and not require the integration to present the sheet.
Topic: UI Frameworks SubTopic: SwiftUI
10
1
347
1w
How to Center an App Icon Image Vertically in a UITableViewCell
Hello! I'm making a list of app icons for users to choose, but when I increase or decrease the font size, the image is still in the same spot and isn't centered vertically with the text. I have it initialized with a frame with hard-coded values, but I was wondering if there was a better way of doing it, such as with constraints or some sort of image scaling. I've provided code blocks and an image of what is happening. ImageView Configuration // App Icon Image UIImageView *appIconImageView = [[UIImageView alloc] initWithFrame: CGRectMake(12.5, 17, 22.5, 22.5)]; // Configurations UIImageSymbolConfiguration *multicolorConfiguration = [UIImageSymbolConfiguration configurationPreferringMulticolor]; UIImageSymbolConfiguration *sizeConfiguration = [UIImageSymbolConfiguration configurationWithScale: UIImageSymbolScaleSmall]; UIImageSymbolConfiguration *appIconConfiguration = [multicolorConfiguration configurationByApplyingConfiguration: sizeConfiguration]; appIconImageView.preferredSymbolConfiguration = appIconConfiguration; appIconImageView.contentMode = UIViewContentModeScaleAspectFill; self.appIconImage = appIconImageView; [appIconImageView release]; ImageView Constraints [self.appIconImage.firstBaselineAnchor constraintEqualToAnchor: self.contentView.firstBaselineAnchor constant: 5.0], [self.appIconImage.leadingAnchor constraintEqualToAnchor: self.contentView.layoutMarginsGuide.leadingAnchor], // Label [self.colorLabel.leadingAnchor constraintEqualToAnchor:self.appIconImage.trailingAnchor constant: 10], [self.colorLabel.trailingAnchor constraintEqualToAnchor:self.contentView.layoutMarginsGuide.trailingAnchor], [self.colorLabel.topAnchor constraintEqualToAnchor: self.contentView.layoutMarginsGuide.topAnchor], [self.colorLabel.bottomAnchor constraintEqualToAnchor: self.contentView.layoutMarginsGuide.bottomAnchor], Image
Topic: UI Frameworks SubTopic: UIKit Tags:
3
0
328
1w
State loss and sheets dismiss on backgrounding app
I've been hitting a weird SwiftUI bug with navigation and state loss and I've managed to reproduce in a very tiny sample project. I've submitted a Feedback FB21681608 but thought it was worth posting here incase any SwiftUI experts can see something obviously wrong. The bug With deeper levels of navigation hierarchy SwiftUI will dismiss views when backgrounding the app. Any work around would be appreciated. This happens in a real app where we have to navigate to a settings screen modally and then a complex flow with other sheets. Sample code Happens in the simulator and on device. import SwiftUI struct ContentView: View { @State private var isPresented = false var body: some View { Button("Show first sheet") { isPresented = true } .sheet(isPresented: $isPresented) { SheetView(count: 1) } } } struct SheetView: View { private enum Path: Hashable { case somePath } @State private var isPresented = false var count: Int var body: some View { NavigationStack { VStack { Text("Sheet \(count)") .font(.largeTitle) // To recreate bug show more than 4 sheets and then switch to the app switcher (CTRL-CMD-Shift-H). // All sheets after number 3 dismiss. Button("Show sheet: \(count + 1)") { isPresented = true } } .sheet(isPresented: $isPresented) { SheetView(count: count + 1) } // Comment out the `navigationDestination` below and the sheets don't dismiss when app goes to the background. // Or move this modifier above the .sheet modifier and the sheets don't dismiss. .navigationDestination(for: Path.self) { _ in fatalError() } } } }
Topic: UI Frameworks SubTopic: SwiftUI
1
1
101
1w
HLS (m3u8) time segments not cached for loop
Our use case requires short looping videos on the app’s front screen. These videos include subtitles for accessibility, so they are delivered as HLS (m3u8) rather than MP4, allowing subtitles to be natively rendered instead of burned into the video. Since moving from MP4 to HLS, we’ve observed that video time segments (.ts / .m4s) are not fully cached between loops. When the video reaches the end and restarts, the same time segments are re-requested from the network instead of being served from cache. This behavior occurs even though: The playlist and segments are identical between loops The content is short and fully downloaded during the first playback No explicit cache-busting headers are present We have investigated available caching options in AVFoundation but have not found a way to persistently cache HLS segments for looping playback without implementing a full offline download using AVAssetDownloadURLSession, which feels disproportionate for this use case. Using Proxyman, I can clearly see repeated network requests for the same HLS time segments on every loop, resulting in unnecessary network usage and reduced efficiency. I would like to understand: Whether this is expected behavior for HLS playback? Whether there is a supported way to cache HLS segments across loops? Or whether there is a recommended alternative approach for looping accessible video with subtitles without re-requesting time segments?
2
0
230
1w
Launchscreen issues on iPadOS 26
There is a problem with the launchscreen of my application on iPadOS 26. After release of the windowed mode feature the launchscreen of my fullscreen landscape-only application is being cropped and doesn't stretch to screen's size when the device is in the portrait mode. How can I fix this?
Topic: UI Frameworks SubTopic: General
3
1
228
1w
Confirmation Items Regarding the Mandatory UIScene Lifecycle Support in iOS 27
After reviewing the following Apple Technote, I have confirmed the statement below: https://developer.apple.com/documentation/technotes/tn3187-migrating-to-the-uikit-scene-based-life-cycle In the next major release following iOS 26, UIScene lifecycle will be required when building with the latest SDK; otherwise, your app won’t launch. While supporting multiple scenes is encouraged, only adoption of scene life-cycle is required. Based on the above, I would appreciate it if you could confirm the following points: Is my understanding correct that the term “latest SDK” refers to Xcode 27? Is it correct that an app built with the latest SDK (Xcode 27, assuming the above understanding is correct) will not launch without adopting the UIScene lifecycle, with no exceptions? Is it correct that an app built with Xcode 26 without UIScene lifecycle support will still launch without issues on an iPhone updated to iOS 27?
Topic: UI Frameworks SubTopic: General Tags:
2
0
177
1w
UIMainMenuSystem: remove "Paste and Match Style" item from Edit menu
The default app menu on iPadOS 26 includes an Edit menu with items (among others) Cut, Copy, Paste, Paste and Match Style. I want to remove the last one. I tried the following but nothing worked: let configuration = UIMainMenuSystem.Configuration() configuration.textFormattingPreference = .removed UIMainMenuSystem.shared.setBuildConfiguration(configuration) { builder in builder.remove(action: .pasteAndMatchStyle) if let command = builder.menu(for: .edit)?.children.first(where: { ($0 as? UICommand)?.action == #selector(UIResponderStandardEditActions.pasteAndMatchStyle(_:)) }) as? UICommand { command.attributes.insert(.hidden) } }
Topic: UI Frameworks SubTopic: UIKit Tags:
2
0
133
1w
UITabGroup child tabs ignoring viewControllerProvider in Sidebar
Hi, I am implementing a sidebar navigation using UITabBarController with the new UITabGroup API on and above iPadOS 18. I’ve encountered an issue where selecting a child UITab within a group does not seem to trigger the child's own viewControllerProvider. Instead, the UITabBarController displays the ViewController associated with the parent UITabGroup. The Issue: In the snippet below, when I tap "Item 2A" or "Item 2B" in the iPad sidebar, the app displays the emptyVC (clear background) defined in the section2Group provider, rather than the teal or cyan ViewControllers defined in the individual child tabs. let item2A = UITab( title: "Item 2A", image: UIImage(systemName: "a.circle"), identifier: "tab.section2.item2a" ) { _ in self.createViewController( title: "Section 2 - Item 2A", color: .systemTeal, description: "Part of Section 2A group" ) } let item2B = UITab( title: "Item 2B", image: UIImage(systemName: "b.circle"), identifier: "tab.section2.item2b" ) { _ in self.createViewController( title: "Section 2 - Item 2B", color: .systemCyan, description: "Part of Section 2B group" ) } item2A.preferredPlacement = .sidebarOnly item2B.preferredPlacement = .sidebarOnly let section2Group = UITabGroup( title: "Section 2", image: UIImage(systemName: "folder.fill"), identifier: "tabgroup.section2", children: [item2A, item2B] ) { _ in // This provider seems to take precedence over children let emptyVC = UIViewController() emptyVC.view.backgroundColor = .clear return emptyVC } section2Group.preferredPlacement = .sidebarOnly tabs.append(section2Group) The Crash: If I attempt to resolve this by removing the viewControllerProvider from the UITabGroup (with the intent that only children should provide views), the application crashes at runtime. The exception indicates that all tabs within the sidebar must have an associated ViewController, suggesting that the UITabGroup requires a provider even if it is intended to act purely as a visual container. Kindly clarify the following: Is it the intended behavior for UITabGroup to override the viewControllerProvider of its children during sidebar selection? Why does the API require the UITabGroup to return a ViewController if the selection target is a child UITab? Is there a specific configuration or delegate method required to allow the UITabBarController to "pass through" the selection to the child tab's provider? I would appreciate any guidance on whether this is an API limitation or if there is a different structural approach recommended for grouped sidebar items.
1
0
80
1w