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

A Summary of the WWDC25 Group Lab - UI Frameworks
At WWDC25 we launched a new type of Lab event for the developer community - Group Labs. A Group Lab is a panel Q&A designed for a large audience of developers. Group Labs are a unique opportunity for the community to submit questions directly to a panel of Apple engineers and designers. Here are the highlights from the WWDC25 Group Lab for UI Frameworks. How would you recommend developers start adopting the new design? Start by focusing on the foundational structural elements of your application, working from the "top down" or "bottom up" based on your application's hierarchy. These structural changes, like edge-to-edge content and updated navigation and controls, often require corresponding code modifications. As a first step, recompile your application with the new SDK to see what updates are automatically applied, especially if you've been using standard controls. Then, carefully analyze where the new design elements can be applied to your UI, paying particular attention to custom controls or UI that could benefit from a refresh. Address the large structural items first then focus on smaller details is recommended. Will we need to migrate our UI code to Swift and SwiftUI to adopt the new design? No, you will not need to migrate your UI code to Swift and SwiftUI to adopt the new design. The UI frameworks fully support the new design, allowing you to migrate your app with as little effort as possible, especially if you've been using standard controls. The goal is to make it easy to adopt the new design, regardless of your current UI framework, to achieve a cohesive look across the operating system. What was the reason for choosing Liquid Glass over frosted glass, as used in visionOS? The choice of Liquid Glass was driven by the desire to bring content to life. The see-through nature of Liquid Glass enhances this effect. The appearance of Liquid Glass adapts based on its size; larger glass elements look more frosted, which aligns with the design of visionOS, where everything feels larger and benefits from the frosted look. What are best practices for apps that use customized navigation bars? The new design emphasizes behavior and transitions as much as static appearance. Consider whether you truly need a custom navigation bar, or if the system-provided controls can meet your needs. Explore new APIs for subtitles and custom views in navigation bars, designed to support common use cases. If you still require a custom solution, ensure you're respecting safe areas using APIs like SwiftUI's safeAreaInset. When working with Liquid Glass, group related buttons in shared containers to maintain design consistency. Finally, mark glass containers as interactive. For branding, instead of coloring the navigation bar directly, consider incorporating branding colors into the content area behind the Liquid Glass controls. This creates a dynamic effect where the color is visible through the glass and moves with the content as the user scrolls. I want to know why new UI Framework APIs aren’t backward compatible, specifically in SwiftUI? It leads to code with lots of if-else statements. Existing APIs have been updated to work with the new design where possible, ensuring that apps using those APIs will adopt the new design and function on both older and newer operating systems. However, new APIs often depend on deep integration across the framework and graphics stack, making backward compatibility impractical. When using these new APIs, it's important to consider how they fit within the context of the latest OS. The use of if-else statements allows you to maintain compatibility with older systems while taking full advantage of the new APIs and design features on newer systems. If you are using new APIs, it likely means you are implementing something very specific to the new design language. Using conditional code allows you to intentionally create different code paths for the new design versus older operating systems. Prefer to use if #available where appropriate to intentionally adopt new design elements. Are there any Liquid Glass materials in iOS or macOS that are only available as part of dedicated components? Or are all those materials available through new UIKit and AppKit views? Yes, some variations of the Liquid Glass material are exclusively available through dedicated components like sliders, segmented controls, and tab bars. However, the "regular" and "clear" glass materials should satisfy most application requirements. If you encounter situations where these options are insufficient, please file feedback. If I were to create an app today, how should I design it to make it future proof using Liquid Glass? The best approach to future-proof your app is to utilize standard system controls and design your UI to align with the standard system look and feel. Using the framework-provided declarative API generally leads to easier adoption of future design changes, as you're expressing intent rather than specifying pixel-perfect visuals. Pay close attention to the design sessions offered this year, which cover the design motivation behind the Liquid Glass material and best practices for its use. Is it possible to implement your own sidebar on macOS without NSSplitViewController, but still provide the Liquid Glass appearance? While technically possible to create a custom sidebar that approximates the Liquid Glass appearance without using NSSplitViewController, it is not recommended. The system implementation of the sidebar involves significant unseen complexity, including interlayering with scroll edge effects and fullscreen behaviors. NSSplitViewController provides the necessary level of abstraction for the framework to handle these details correctly. Regarding the SceneDelagate and scene based life-cycle, I would like to confirm that AppDelegate is not going away. Also if the above is a correct understanding, is there any advice as to what should, and should not, be moved to the SceneDelegate? UIApplicationDelegate is not going away and still serves a purpose for application-level interactions with the system and managing scenes at a higher level. Move code related to your app's scene or UI into the UISceneDelegate. Remember that adopting scenes doesn't necessarily mean supporting multiple scenes; an app can be scene-based but still support only one scene. Refer to the tech note Migrating to the UIKit scene-based life cycle and the Make your UIKit app more flexible WWDC25 session for more information.
Topic: UI Frameworks SubTopic: General
0
0
500
Jun ’25
How do you compute backing pixel alignment in SwiftUI's `Layout`?
When performing custom layout in AppKit, it's essential that you pixel align frames using methods like backingAlignedRect. The alignment differs depending on the backingScaleFactor of the parent window. When building custom Layouts in SwiftUI, how should you compute the alignment of a subview.frame in placeSubviews() before calling subview.place(...)? Surprisingly, I haven't seen any mention of this in the WWDC videos. However, if I create a Rectangle of width 1px and then position it on fractional coordinates, I get a blurry view, as I would expect. Rounding to whole numbers works, but on Retina screens you should be able to round to 0.5 as well. func placeSubviews( in bounds: CGRect, proposal: ProposedViewSize, subviews: Subviews, cache: inout Void ) { // This should be backing aligned based on the parent window's backing scale factor. var frame = CGRect( x: 10.3, y: 10.8, width: 300.6, height: 300.1 ) subview.place( at: frame.origin, anchor: .topLeading, proposal: ProposedViewSize(frame.size) ) }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
0
0
4
43m
TabView with NavigationStack issue on macOS Tahoe Beta 7
I have an app using TabView with multiple Tabs using tabViewStyle „sidebarAdaptable“. Each Tab does have its own NavigationStack. When I switch multiple times between the tabs and append a child view to one of my navigation stacks, it will stop working after a few tries with the following error „A NavigationLink is presenting a value of type “HomeStack” but there is no matching navigationDestination declaration visible from the location of the link. The link cannot be activated. Note: Links search for destinations in any surrounding NavigationStack, then within the same column of a NavigationSplitView.“ The same code is working fine on iOS, iPadOS but not working on macOS. When I remove tabViewStyle of sidebarAdaptable it’s also working on macOS. I shrinked it down to a minimal reproducible code sample. Any idea if that is a bug or I'm doing something wrong? struct ContentView: View { @State private var appState: AppState = .init() var body: some View { TabView(selection: $appState.rootTab) { Tab("Home", systemImage: "house", value: RootTab.home) { NavigationStack(path: $appState.homeStack) { Text("Home Stack") NavigationLink("Item 1", value: HomeStack.item1) .padding() NavigationLink("Item 2", value: HomeStack.item2) .padding() .navigationDestination(for: HomeStack.self) { stack in Text("Stack \(stack.rawValue)") } .navigationTitle("HomeStack") } } Tab("Tab1", systemImage: "gear", value: RootTab.tab1) { NavigationStack(path: $appState.tab1Stack) { Text("Tab 1 Stack") NavigationLink("Item 1", value: Tab1Stack.item1) .padding() NavigationLink("Item 2", value: Tab1Stack.item2) .padding() .navigationDestination(for: Tab1Stack.self) { stack in Text("Stack \(stack.rawValue)") } .navigationTitle("Tab1Stack") } } } .tabViewStyle(.sidebarAdaptable) .onChange(of: appState.rootTab) { _, _ in appState.homeStack.removeAll() appState.tab1Stack.removeAll() } } } @MainActor @Observable class AppState { var rootTab: RootTab = .home var homeStack: [HomeStack] = [] var tab1Stack: [Tab1Stack] = [] } enum RootTab: Hashable { case home case tab1 case tab2 } enum HomeStack: String, Hashable { case home case item1 case item2 } enum Tab1Stack: String, Hashable { case home case item1 case item2 }
0
0
9
1h
iOS 26 (beta 7) setting .searchFocused programmatically does not work
Already filed a feedback in case this is a bug, but posting here in case I'm doing something wrong? I'd like the search field to automatically be displayed with the keyboard up when the view appears. This sample code works in iOS 18, but it does not work in iOS 26 beta 7 I also tried adding a delay to setting searchIsFocused = true but that did not help struct ContentView: View { var body: some View { NavigationStack { NavigationLink(destination: ListView()) { Label("Go to list", systemImage: "list.bullet") } } .ignoresSafeArea() } } struct ListView: View { @State private var searchText: String = "" @State private var searchIsPresented: Bool = false @FocusState private var searchIsFocused: Bool var body: some View { ScrollView { Text("Test") } .searchable(text: $searchText, isPresented: $searchIsPresented, placement: .automatic, prompt: "Search") .searchFocused($searchIsFocused) .onAppear { searchIsFocused = true } } }
0
0
15
3h
Squicle app icons on macOS 26
Just posted this feedback regarding macOS 26 "Tahoe" (FB19853155) - please support with additional submissions if you share my view. I will miss the beautiful and individual designed icons of the past! "macOS 26 is enforcing squicles for app icons, falling back to a grey background for 3rd party apps without a compliant AppIcon asset. As a result many original app icons are reduced in size and hard to distinguish because they share the same background color. Although I respect Apple's strive for an iOS-like UI on Macs, a smooth transition path would be more user- and developer-friendly ... e.g. with some info.plist property to opt-out icon migration, potentially ignored by a future macOS version. The current solution causes a bad usability, and makes the system look inconsistent as many - especially free - software will not be updated with new icon designs. Please reconsider this bad design decision!"
1
0
126
1d
Menu view flashes white before closing when device is set to dark appearance
Feedback ID: FB19846667 When dismissing a Menu view when the device is set to dark appearance, there is a flash of lightness that is distracting and feels unnatural. This becomes an issue for apps that rely on the user interacting with Menu views often. When using the overflow menu on a toolbar, the effect of dismissing the menu is a lot more natural and there is less flashing. I expect a similar visual effect when creating Menu views outside of a toolbar. Has anyone found a way around this somehow? Comparison between dismissing a menu and a toolbar overflow: https://www.youtube.com/shorts/H2gUQOwos3Y Slowed down version of dismissing a menu with a visible light flash: https://www.youtube.com/shorts/MBCCkK-GfqY
0
0
117
1d
iOS 26 @FocusState Doesn't Work If TextField Is In Toolbar
When I add a TextField with @FocusState to a toolbar, I noticed that setting focus = false doesn't cause the form to lose focus If I move the TextField out of the toolbar setting focus = false works fine. How can I unfocus the text field when the cancel button is tapped? Minimal example tested on Xcode Version 26.0 beta 6 (17A5305f): import SwiftUI struct ContentView: View { @State private var text: String = "" @FocusState private var focus: Bool var body: some View { NavigationStack { List { Text("Test List") } .toolbar { ToolbarItem(placement: .bottomBar) { TextField("Test", text: $text) .padding(.horizontal) .focused($focus) } ToolbarItem(placement: .bottomBar) { Button(role: .cancel) { focus = false // THIS DOESN'T WORK! } } } } } } #Preview { ContentView() }```
0
0
144
1d
iOS 26 (beta) Nav Bar Item Image Insets bug
I've noticed that in iOS 26, Navigation Bar Items' Image Insets parameters as set in Xcode are not being read correctly. Specifically, it appears that on iOS 26 beta, negative inset numbers are being read as positive. Feedback report FB19838333 includes a sample project demonstrating this bug.
0
0
74
1d
How do you observe the count of records in a Swift Data relationship?
What is the correct way to track the number of items in a relationship using SwiftData and SwiftUI? Imagine a macOS application with a sidebar that lists Folders and Tags. An Item can belong to a Folder and have many Tags. In the sidebar, I want to show the name of the Folder or Tag along with the number of Items in it. I feel like I'm missing something obvious within SwiftData to wire this up such that my SwiftUI views correctly updated whenever the underlying modelContext is updated. // The basic schema @Model final class Item { var name = "Untitled Item" var folder: Folder? = nil var tags: [Tag] = [] } @Model final class Folder { var name = "Untitled Folder" var items: [Item] = [] } @Model final class Tag { var name = "Untitled Tag" var items: [Item] = [] } // A SwiftUI view to show a Folder. struct FolderRowView: View { let folder: Folder // Should I use an @Query here?? // @Query var items: [Item] var body: some View { HStack { Text(folder.name) Spacer() Text(folder.items.count.formatted()) } } } The above code works, once, but if I then add a new Item to that Folder, then this SwiftUI view does not update. I can make it work if I use an @Query with an #Predicate but even then I'm not quite sure how the #Predicate is supposed to be written. (And it seems excessive to have an @Query on every single row, given how many there could be.) struct FolderView: View { @Query private var items: [Item] private var folder: Folder init(folder: Folder) { self.folder = folder // I've read online that this needs to be captured outside the Predicate? let identifier = folder.persistentModelID _items = Query(filter: #Predicate { link in // Is this syntax correct? The results seem inconsistent in my app... if let folder = link.folder { return folder.persistentModelID == identifier } else { return false } }) } var body: some View { HStack { Text(folder.name) Spacer() // This mostly works. Text(links.count.formatted()) } } } As I try to integrate SwiftData and SwiftUI into a traditional macOS app with a sidebar, content view and inspector I'm finding it challenging to understand how to wire everything up. In this particular example, tracking the count, is there a "correct" way to handle this?
0
0
79
2d
Compositional Layout's broken `visibleItemsInvalidationHandler`
Hello everybody! TLDR: Issues with visibleItemsInvalidationHandler. Minimal code to reproduce available. I've been working with Compositional Layout for a while now and recently I've found myself needing to implement custom animation based on scroll position of UI elements. Once I found visibleItemsInvalidationHandler it felt like the exact solution that I needed. Once I implement I've found out it doesn't quite behave as you'd expect. To put it simply, it seems like the animations only work if your whole layout does not use .estimated nor .uniformAcrossSiblings. As soon as you use them then the animations will stop working, I've debugged it deeper and it seems like the invalidation context generated by it does not include the indexPath of the cells, which is always included in the version in which it works. Feel free to swap the line 51 with its comment to flip between the working and failing version of it. Playground Example My final question therefore is... Is this the expected behavior? The documentation doesn't give any clues about such behavior and although I've tried relentlessly to find a workaround for this specific hiccup I was not successful with it.
0
0
47
2d
`Invalid frame dimension (negative or non-finite)` on iPhone 12 mini
Hi everyone, I’m encountering the following error when displaying a TextField inside a Form together with a ToolbarItem(placement: .keyboard): Invalid frame dimension (negative or non-finite). Environment This issue reproduces on iPhone 12 mini (iOS 18.6). The same code does not reproduce on iPhone 15. I confirmed that explicitly constraining the size of the TextField or Text with .frame(width:height:) does not resolve the issue. Minimal Reproducible Example import SwiftUI struct Test: View { @State var value: Int = 0 var body: some View { Form { TextField("0", value: $value, format: .number) } .toolbar { ToolbarItem(placement: .keyboard) { Text("Close") } } } } Has anyone else encountered this issue? Is this a known bug, or is there a recommended workaround for devices with smaller screen widths such as the iPhone 12 mini? Thanks in advance for your help! Best regards, Naoya Ozawa
Topic: UI Frameworks SubTopic: SwiftUI
0
0
43
2d
Compatibility of Liquid Glass Effect on Older Apple TV Models
Hello everyone, Following the WWDC 2025 announcement of tvOS 26 and the introduction of the new Liquid Glass effect, Apple published a press release mentioning that Liquid Glass is "available on Apple TV 4K (2nd generation and later)". This seems to exclude both the Apple TV HD and the 1st generation Apple TV 4K, even though both devices remain compatible with tvOS 26. Source: Apple Newsroom ( https://www.apple.com/newsroom/2025/06/apple-tv-brings-a-beautiful-redesign-and-enhanced-home-entertainment-experience ) I’m wondering: Will using UIGlassEffect or glassEffect(_:in:) on these older devices cause a crash? If not, will the effect fall back to a simple blur, or render as fully transparent? Is there an API or recommended way to detect whether the Liquid Glass effect is supported on the current device? Thanks in advance for your insights!
0
0
33
2d
contentMargins (with .horizontal) creates a visual bug with the sidebar when using a NavigationSplitView in iOS 26 beta 7
FB: FB19828741 Maybe I am doing something wrong with the new LiquidGlass sidebar using iPadOS 26 Beta 7, but when using this code, in stead of the List being centered between the sidebar and the rest of the screen, the cell itself extends beneath the sidebar but the content stays clear of the sidebar, giving a weird visual effect. Not my expected behavior at least. Any ideas? Or just a bug? import SwiftUI struct ContentView: View { var body: some View { NavigationSplitView { Text("Test") } detail: { List { Text("ContentMargin") } .contentMargins(.horizontal, 100.0) } } } #Preview { ContentView() } This was on iPad OS 18:
0
0
47
2d
Issue with custom keyboard height when rotating from landscape to portrait in iOS 26 beta.
When using a custom keyboard set via UIResponder.inputView, a gap appears between the text field and the custom keyboard after rotating from portrait to landscape and back to portrait. On a portrait screen, when switching to a custom keyboard: The input field at the top and the custom keyboard below it appear normally, with no empty space in between. When I rotate from portrait to landscape, a gap appears in the middle.
Topic: UI Frameworks SubTopic: UIKit
0
0
25
2d
WKWebView LoadRequest crash on ios 26
Since the ios 26 beta our app is crashing when calling LoadRequest() on the wkwebview class. The app crashes out completely when it occurs even in the debugger, I was able to get a stack trace from our Sentry crash handler. See below It seems that calling LoadRequest from the mainthread fixes the issue but I don't understand why, theres no documentation to suggest this must be done. Any ideas? Below is the stack trace I got from Sentry: WebKit +0x0054e00 WebKit::allDataStores WebKit +0x0bf34f4 WebKit::NetworkProcessProxy::preconnectTo WebKit +0x0acef64 WebKit::WebPageProxy::preconnectTo WebKit +0x0b0d92c WTF::Detail::CallableWrapper::call WebKit +0x0ab6cf8 WebKit::WebPageProxy::maybeInitializeSandboxExtensionHandle WebKit +0x0ab84dc WebKit::WebPageProxy::loadRequestWithNavigationShared WebKit +0x0ab7adc WebKit::WebPageProxy::loadRequest WebKit +0x05d0704 -[WKWebView loadRequest:] Grid3iOS +0x5240944 xamarin_dyn_objc_msgSendSuper In App Grid3iOS +0x187dec4 wrapper_managed_to_native_ObjCRuntime_Messaging_NativeHandle_objc_msgSendSuper_NativeHandle_intptr_intptr_ObjCRuntime_NativeHandle In App Grid3iOS +0x512fac4 Microsoft_iOS_WebKit_WKWebView_LoadRequest_Foundation_NSUrlRequest (WKWebView.g.cs:572)
1
0
25
2d
How to get view backgrounds for widget with clear or tinted rendering
The calendar widget and buttons shows a lightened / material background behind some content when the widget is in clear / tinted mode (example here: https://developer.apple.com/videos/play/wwdc2025/278?time=72). How can this be done? I tried applying a material and glass background to a view using the .background(...) modifier, but the background is made white. Text("Hello") .padding() .background { ContainerRelativeShape() .fill(.thinMaterial) } Text("Hello") .padding() .background { ContainerRelativeShape() .glassEffect() } Is this not supported, a bug, or am I doing something wrong?
1
0
77
2d
UIGlassEffect can leave an unusual grey shadow around the view
When adding a glass effect to my UIControl: let effectView = UIVisualEffectView() let glassEffect = UIGlassEffect() glassEffect.isInteractive = true effectView.effect = glassEffect effectView.cornerConfiguration = .capsule() addSubview(effectView) effectView.snp.makeConstraints { $0.edges.equalToSuperview() } effectView.contentView.addSubview(stackView) for subview in effectView.subviews { subview.backgroundColor = .clear } self.effectView = effectView I find that I get this visual effect: These controls are the only view within a UICollectionViewCell. Nothing in the hierarchy of the collectionview to the control has a background color. The grey background only seems to appear when I place the glass effect. Without the glass effect, there is no grey shading.
Topic: UI Frameworks SubTopic: UIKit
3
0
100
2d
.textContentType(.emailAddress) does not work as expected
The following code: struct ContentView: View { @State private var email = "" var body: some View { VStack { TextField("email", text: $email) .textContentType(.emailAddress) } } } does not work as expected. What I expected is to run the app and have it suggest my actual email when I click into the field. Instead what it does is display "Hide My Email" twice. Selecting the first "Hide My Email" pastes the actual text "Hide My Email" into the field, the second one brings up an iCloud sheet to select a random email. Trying some suggestions online for .emailAddress in general not working does not change anything: TextField("Email", text: $email) .textFieldStyle(RoundedBorderTextFieldStyle()) .textContentType(.emailAddress) .keyboardType(.emailAddress) .autocorrectionDisabled() .disableAutocorrection(true) .textInputAutocapitalization(.never)
Topic: UI Frameworks SubTopic: SwiftUI
1
0
93
3d