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

Setting the highlight colour of a selected cell in NSTableView
That's a question for Mac app (Cocoa). I want to change the standard highlighting. I thought to use tableView.selectionHighlightStyle. But there are only 2 values: .none and .regular. Cannot find how to define a custom one. So I tried a workaround: set tableView.selectionHighlightStyle to .none func tableView(_ tableView: NSTableView, viewFor tableColumn: NSTableColumn?, row: Int) -> NSView? { tableView.selectionHighlightStyle = .none keep track of previousSelection Then, in tableViewSelectionDidChange reset for previousSelection func tableViewSelectionDidChange(_ notification: Notification) { } if previousSelection >= 0 { let cellView = theTableView.rowView(atRow: previousSelection, makeIfNecessary: false) cellView?.layer?.backgroundColor = .clear } set for the selection to a custom color let cellView = theTableView.rowView(atRow: row, makeIfNecessary: false) cellView?.layer?.backgroundColor = CGColor(red: 0, green: 0, blue: 1, alpha: 0.4) previousSelection = row Result is disappointing : Even though tableView.selectionHighlightStyle is set to .none, it does overlays the cellView?.layer Is there a way to directly change the color for selection ?
4
0
125
6d
SwiftUI ScrollView scrollTo not consistently scrolling to latest message
I am implementing an AI chat application and aiming to achieve ChatGPT-like behavior. Specifically, when a new message is sent, the ScrollView should automatically scroll to the top to display the latest message. I am currently using the scrollTo method for this purpose, but the behavior is inconsistent—sometimes it works as expected, and other times it does not. I’ve noticed that this issue has been reported in multiple places, which suggests it may be a known SwiftUI limitation. I’d like to know: Has this issue been fixed in recent SwiftUI versions, or does it still persist? If it still exists, is there a reliable solution or workaround that anyone can recommend?
3
0
172
1w
.glassEffect() renders dark on device but works on simulator - TestFlight doesn't fix it
iOS 26 SwiftUI .glassEffect() renders dark/gray on physical device - TestFlight doesn't fix it .glassEffect() renders as dark/muddy gray on my physical iPhone instead of the light frosted glass like Apple Music's tab bar. What I've confirmed: Same code works perfectly on iOS Simulator Apple Music and other Apple apps show correct Liquid Glass on same device Brand new Xcode project with just .glassEffect() also renders dark TestFlight build (App Store signing) has the SAME problem - still dark/gray This rules out developer signing vs App Store signing as the cause What I've tried: Clean build, delete derived data, reinstall app Completely reinstalled Xcode All accessibility settings correct (Reduce Transparency OFF, Liquid Glass set to Clear) Disabled Metal diagnostics Debug and Release builds Added window configuration for Extended sRGB/P3 color space Added AppDelegate with configureWindowForLiquidGlass() Tried .preferredColorScheme(nil) Tried background animation to force "live" rendering Environment: iPhone 17 Pro, iOS 26.3 Xcode 26.2 macOS 26.3 The question: Why does .glassEffect() work for Apple's apps but not third party apps, even with App Store signing via TestFlight? What am I missing?
5
0
253
1w
Horrible weird Window Server killing bug
OS 26.s, Xcode 26.2 TLDR: My pure SwiftUI app freezes the window server, is this a known problem? My app is pure SwiftUI, no low level calls, no networking, no tricksy pointer use. Somehow, something in my code is terminally confusing the Window Server. As in, I run the app, and before I ever seen a window, the Window Server locks up, and is killed by the OS for being unresponsive. Using debugging shows that I get to the end of a Canvas, and it simply freezes upon exiting. I'm about to do the old comment out everything, and bring it back a bit at a time, but I'm wondering if anyone is experiencing this sort of thing? The reaction is so extreme. And it's not Xcode in particular, I built the program with xcodebuild, Xcode itself not running, and ran my app, and it did the same thing.
Topic: UI Frameworks SubTopic: SwiftUI
2
0
71
1w
screenshot on iOS26
I had take screenshots by following code let scenes = UIApplication.shared.connectedScenes let windowScene = scenes.first as? UIWindowScene let window = windowScene?.windows.first self.uiImage = window?.rootViewController?.view!.getImage(rect: rect) View has two views. One is ImageView contains some image and overlay of image detection results with .overlay. another view is InfoView contains several info and button which above code fired. on iOS 17, I can take screenshots as I saw, but on iOS26, missing on image of ImageView. Overlay(detected rectangle) in Imageview and InfView can be taken. How can I take screenshots as I saw on iOS26?(iPad)
9
0
476
1w
tvOS - how to stop OS from backgrounding my app
I have an Apple TV photo slideshow app (Objective-C, Storyboard based, transitioned to scenes and UIKit from old Appdelegate model) which is trivial but exhibits a problem I can't fix. The app has 2 UIImageViews, pulls photos from iCloud, replaces the back view, fades between them, swaps front and back images. I cannot for the life of me work out how to tell tvOS / UIKit that I need to stay in the foreground. Other slideshow apps manage it, clearly movie viewing apps like Netflix, Disney+ and BBC iPlayer manage to stay on top without the user needing to interact with the UI, but I keep getting pushed out. The pushing out happens only if I am playing music on the Apple TV, either using the built-in music app or AirPlaying music to the Apple TV from an iPad or phone. The issue is reproducible in an app that does nothing except load up a photo from the main bundle into a UIImageView. It's as if the OS thinks I'm idle and I need to nudge it to remind it I'm still here, but I can find no hints in Apple's documentation as to how I should do this. Project of trivial app here : https://drive.google.com/file/d/1eY_nQJ7adHEgAvFwhS-t38dqBEPVovub/view?usp=sharing
Topic: UI Frameworks SubTopic: UIKit
1
0
83
1w
How to make fluid TabBar
Hey there guys, I'm new on SwiftUI and iOS Development world. How can I achieve a seamless TabBar transition in SwiftUI? Currently, when I programmatically hide the TabBar on a pushed view and swipe back to the previous view, there is a noticeable delay before the TabBar reappears. How can I make it appear instantly? Here is the link to the video https://streamable.com/3zz2o2 Thank you in advance
Topic: UI Frameworks SubTopic: SwiftUI
2
0
115
1w
SwiftUI subviews traverse issue
Our project include UIKIt and SwiftUI, and in some case, we need to traverse all subviews, for UIKit implement views, below code: func findView(byIdentifier identifier: String) -> UIView? { if self.accessibilityIdentifier == identifier { return self } for subview in subviews { if let found = subview.findView(byIdentifier: identifier) { return found } } return nil } works well, but for SwiftUI implement views, like below code: struct ContentView: View { var body: some View { VStack { Image(systemName: "globe") .imageScale(.large) .foregroundStyle(.tint) .accessibilityIdentifier("Image") Text("Hello, world!") .accessibilityIdentifier("Text") } .padding() } } it can not find subviews in the ContentView, and only a view with type: _UIHostingView<ModifiedContent<AnyView, RootModifier>> can be found, the Image and Text is not found; And because we have set a accessibilityIdentifier property, so we also try use: @MainActor var accessibilityElements: [Any]? { get set } to find sub node, but this accessibilityElements is not stable, we can find the Image and Text node in iOS26.1 system: [AX] level=3 AccessibilityNode @ 0x000000010280fb10 id=Image [AX] level=3 AccessibilityNode @ 0x000000010161fbf0 id=Text but can not find it in iOS26.0 and below system. Any suggestion in how to find SwiftUI subviews? thank you
Topic: UI Frameworks SubTopic: SwiftUI
2
0
152
1w
Creating New Document from Clipboard -- if valid
I have a MacOS app which displays PDFs, and I want to create a New document from the Clipboard, if the clipboard contains valid graphical data. My problem is that even if it doesn't, I still get a blank new document window. AppKit always creates a new document. I've tried overriding the newDocument function; I've tried avoiding the built-in functions altogether. Are there any general recommendations for going about this?
3
0
240
1w
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
259
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
61
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?
7
0
393
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
151
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
89
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
85
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
51
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
384
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
67
1w