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

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
658
Jun ’25
Getting NSScrollView to scroll to an Offset with animation
Hi I have a NSTextView set as the document of a NSScrollView scrollView.documentView = textView I want to programatically scroll to a specific offset in the scrollView. I use the following function and it jumps to the right location: scrollView.documentOffset = offset However I would like to animate the scrolling. Any suggestions? Also to mention, I have not flipped the coordinates of the NSTextView Thanks Reza
Topic: UI Frameworks SubTopic: AppKit
1
0
59
8h
UIBarButtonItem has a lot of constraints warnings
The issue can be reproduced using the simplest code. In Xcode 26 + iOS 26, when a UIBarButtonItem is created using a UIImage, it consistently prints numerous constraint conflict warnings to the console. Below is my test code and the console warnings: let btn = UIBarButtonItem(systemItem: .trash) self.toolbarItems = [btn] Unable to simultaneously satisfy constraints. Probably at least one of the constraints in the following list is one you don't want. Try this: (1) look at each constraint and try to figure out which you don't expect; (2) find the code that added the unwanted constraint or constraints and fix it. ( "<NSLayoutConstraint:0x1083b4550 _TtC5UIKitP33_DDE14AA6B49FCAFC5A54255A118E1D8713ButtonWrapper:0x108374e00.width == _UIButtonBarButton:0x1083e8000.width (active)>", "<NSLayoutConstraint:0x1083b4aa0 'IB_Leading_Leading' H:|-(2)-[_UIModernBarButton:0x103ac62e0] (active, names: '|':_UIButtonBarButton:0x1083e8000 )>", "<NSLayoutConstraint:0x1083b4af0 'IB_Trailing_Trailing' H:[_UIModernBarButton:0x103ac62e0]-(2)-| (active, names: '|':_UIButtonBarButton:0x1083e8000 )>", "<NSLayoutConstraint:0x1083b4fa0 'UIView-Encapsulated-Layout-Width' _TtC5UIKitP33_DDE14AA6B49FCAFC5A54255A118E1D8713ButtonWrapper:0x108374e00.width == 0 (active)>" ) Will attempt to recover by breaking constraint <NSLayoutConstraint:0x1083b4af0 'IB_Trailing_Trailing' H:[_UIModernBarButton:0x103ac62e0]-(2)-| (active, names: '|':_UIButtonBarButton:0x1083e8000 )> Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger. The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKitCore/UIView.h> may also be helpful.
1
0
89
16h
Fix text in accessory view
Do you guys know how to fix the render of the text in the accessory view ? If I force the color of text to be .black it work but it will break dark mode, but forcing it .black : .white on color scheme changes makes white to still adapt to what is behind it I have noticed that Apple Music doesn’t have that artifact and it seems to break when images are behind the accessory view // MARK: - Next Routine Accessory @available(iOS 26.0, *) struct NetxRoutinesAccessory: View { @ObservedObject private var viewModel = RoutineProgressViewModel.shared @EnvironmentObject var colorSchemeManager: ColorSchemeManager @EnvironmentObject var routineStore: RoutineStore @EnvironmentObject var freemiumKit: FreemiumKit @ObservedObject var petsStore = PetsStore.shared @Environment(\.colorScheme) private var colorScheme // Tab accessory placement environment @Environment(\.tabViewBottomAccessoryPlacement) private var accessoryPlacement // Navigation callback var onTap: (() -> Void)? @State private var isButtonPressed = false /// Explicit black for light mode, white for dark mode private var textColor: Color { colorScheme == .dark ? .trueWhite : .trueBlack } /// Returns true when the accessory is in inline/minimized mode private var isInline: Bool { accessoryPlacement == .inline } var body: some View { accessoryContent() .onTapGesture { onTap?() } } private func accessoryContent() -> some View { HStack(spacing: 12) { // Content with smooth transitions VStack(alignment: .leading, spacing: 2) { if viewModel.totalTasks == 0 { Text(NSLocalizedString("Set up routines", comment: "Routines empty state")) .font(.subheadline.weight(.medium)) .foregroundColor(textColor) } else if let next = viewModel.nextRoutineTask() { HStack(spacing: 4) { Text(NSLocalizedString("Next", comment: "Next routine prefix")) .font(.caption) .foregroundColor(textColor) Text("•") .font(.caption) .foregroundColor(textColor) Text(next.routine.name) .font(.subheadline.weight(.medium)) .foregroundColor(textColor) .lineLimit(1) } .id("routine-\(next.routine.id)-\(next.time)") .transition(.opacity.combined(with: .move(edge: .leading))) HStack(spacing: 4) { Text(viewModel.petNames(for: next.routine.petIDs)) .font(.caption) .foregroundColor(textColor) Text("•") .font(.caption) .foregroundColor(textColor) Text(Routine.displayTimeFormatter.string(from: next.time)) .font(.caption.weight(.medium)) .foregroundColor(colorSchemeManager.accentColor ?? .blue) } .id("time-\(next.routine.id)-\(next.time)") .transition(.opacity.combined(with: .move(edge: .leading))) } else { // All tasks completed Text(NSLocalizedString("All done for today!", comment: "All routines completed")) .font(.subheadline.weight(.medium)) .foregroundColor(textColor) .transition(.opacity.combined(with: .scale)) Text("\(viewModel.completedTasks)/\(viewModel.totalTasks) " + NSLocalizedString("tasks", comment: "Tasks count suffix")) .font(.caption) .foregroundColor(textColor) } } .animation(colorSchemeManager.reduceMotion ? nil : .snappy(duration: 0.3), value: viewModel.completedTasks) .animation(colorSchemeManager.reduceMotion ? nil : .snappy(duration: 0.3), value: viewModel.progress) } .padding() .contentShape(.rect) .animation(colorSchemeManager.reduceMotion ? nil : .snappy(duration: 0.35), value: viewModel.completedTasks) } }
Topic: UI Frameworks SubTopic: SwiftUI
0
0
46
1d
UIToolbar buttons losing spacing in Xcode 26.1.1 Legacy Mode (UIDesignRequiresCompatibility)
We're using XCode 26.1.1 We do not have resource to adopt Liquid Glass design. Hence, we are using the following workaround <key>UIDesignRequiresCompatibility</key> <true/> This is our Storyboard. Pre XCode 26 Before XCode 26.1.1, the bottom toolbar looks great. In XCode 26 However, in XCode 26.1.1, the bottom toolbar buttons seems to "Squish together". Do anyone have any idea, how I can make UIToolbar works by enabling UIDesignRequiresCompatibility? Thanks.
Topic: UI Frameworks SubTopic: UIKit Tags:
0
0
58
1d
Search Functionality Missing in FamilyActivityPicker on iPadOS 26.0+
Issue: The search functionality in FamilyActivityPicker has disappeared on iPadOS 26.0+. This feature was working in previous versions but is now missing. Framework: FamilyControls Expected: Search bar should be available in FamilyActivityPicker to help users find apps quickly. Actual: Search functionality is completely missing. Impact: Makes app selection difficult for users with many installed apps. Is this a known issue? If it's a bug, please address it in an upcoming update. If intentional, guidance on alternatives would be appreciated. Thank you.
0
0
10
1d
NSGlassEffectView issue on macOS 26.2
I have a borderless NSWindow with transparent background floating at Dock level and with collectionBehavior set to NSWindowCollectionBehaviorCanJoinAllSpaces. To render its background I was using an NSVisualEffectView, but, with the introduction of Liquid Glass, I decided to replace it with a NSGlassEffectView on Tahoe. On macOS 26.0 and 26.1 all works fine: my window's background is correctly rendered and updated. On macOS 26.2 this is not so: the background seems cached and doesn't update if I move my window or if I drag some other window underneath it. My window's movable property is set to NO (and I need this to be so): dragging is implemented by handling mouseDown, mouseDragged, and mouseUp events. Just to experiment, I tried setting movable and movableByWindowBackground both to YES. In this case, the NSGlassEffectView is correctly updated if I move the window itself, but doesn't change if I move other windows underneath it. Has anybody experienced a similar problem on maOS 26.2? If so, is there a way to solve it? Thanks, Marco
Topic: UI Frameworks SubTopic: AppKit
0
0
115
1d
Persistent Control Center landscape layout reset after SpringBoard jetsam during charging idle (iOS 26.0–26.2)
Since iOS 26.0, the Control Center layout consistently resets in landscape orientation after certain system events. This issue is still present in the official public release of iOS 26.2. The reset occurs without a visible reboot and appears to be triggered by a background SpringBoard termination (jetsam) during charging idle maintenance windows (typically overnight while the device is plugged in). After SpringBoard relaunches: • The portrait Control Center layout is restored correctly • The landscape Control Center layout is reinitialized using the default order This indicates a state restoration failure rather than a user configuration or sync issue. ⸻ Steps to Reproduce: Use an iPhone 15 Pro running iOS 26.0, 26.1, or 26.2 Manually reorder Control Center controls Leave the device plugged in and idle overnight During charging idle, SpringBoard is terminated in the background due to memory pressure (no visible reboot) Open Control Center the next day: • Portrait layout is preserved • Landscape layout has reverted to default ⸻ Expected Result: Both portrait and landscape Control Center layouts should persist across SpringBoard restarts caused by jetsam or memory pressure, including during charging idle maintenance. ⸻ Actual Result: After SpringBoard relaunch: • Portrait layout is restored correctly • Landscape layout is lost and recreated using the default configuration ⸻ Analytics / Logs (relevant excerpt): Process: SpringBoard Case Type: MemoryResourceException Subtype: MREExceptionFatalLimitActive This occurs during charging idle and does not require a user-initiated reboot. ⸻ Additional Observations: • Issue does not occur when the device is idle overnight without charging • Manual reordering works correctly until the next SpringBoard jetsam • Resetting settings, disabling iCloud sync, or reinstalling iOS does not resolve the issue • This behavior has persisted across multiple major and minor releases, indicating a regression or unresolved bug ⸻ Suspected Root Cause: Incomplete state restoration in ControlCenterKit after SpringBoard relaunch following jetsam during charging idle. Portrait state is restored; landscape state falls back to default.
Topic: UI Frameworks SubTopic: UIKit
1
0
90
2d
Tapping on ShareLink crashes the app
Overview Tapping on ShareLink crashes the app when ShareLink is added in the toolbar with the placement of secondaryAction Feedback FB21337385 Note: Apple engineers please priorities this is a blocker and affects production apps and prevents us from going live. Environment Xcode: 26.2 (17C52) iOS: 26.2 iPadOS: 26.2 Reproduce Able to reproduce 100% both on Simulator and Device Isolation of the crash The crash happens only when the ShareLink is used with the placement .secondaryAction The crash doesn't 'happen when the ShareLink is used with the placement .primaryAction Code import SwiftUI struct ContentView: View { var body: some View { NavigationStack { Text("Hello, world!") .toolbar { ToolbarItem(placement: .primaryAction) { Button("Dummy") { print("dummy") } } // Tapping on share button will cause it to crash // Crash only happens when the ShareLink is used with placement .secondaryAction // It doesn't crash when placement is primaryAction ToolbarItem(placement: .secondaryAction) { ShareLink(item: "Some string") } } } } } Crash stack trace *** Terminating app due to uncaught exception 'NSGenericException', reason: 'UIPopoverPresentationController (<_UIActivityViewControllerPresentationController: 0x105a3b580>) should have a non-nil sourceView or barButtonItem set before the presentation occurs.' *** First throw call stack: ( 0 CoreFoundation 0x00000001804f71d0 __exceptionPreprocess + 172 1 libobjc.A.dylib 0x000000018009c094 objc_exception_throw + 72 2 UIKitCore 0x0000000185a5b17c -[UIPopoverPresentationController presentationTransitionWillBegin] + 2712 3 UIKitCore 0x0000000185a65de0 -[UIPresentationController _presentationTransitionWillBegin] + 28 4 UIKitCore 0x0000000185a6523c __80-[UIPresentationController _initViewHierarchyForPresentationSuperview:inWindow:]_block_invoke + 1928 5 UIKitCore 0x0000000185a633ec __77-[UIPresentationController runTransitionForCurrentStateAnimated:handoffData:]_block_invoke_3 + 296 6 UIKitCore 0x00000001868b2950 -[_UIAfterCACommitBlock run] + 64 7 UIKitCore 0x00000001868b2d64 -[_UIAfterCACommitQueue flush] + 164 8 UIKitCore 0x0000000186354f04 _runAfterCACommitDeferredBlocks + 256 9 UIKitCore 0x0000000186346bec _cleanUpAfterCAFlushAndRunDeferredBlocks + 76 10 UIKitCore 0x0000000186346cb4 _UIApplicationFlushCATransaction + 68 11 UIKitCore 0x0000000186263c48 __setupUpdateSequence_block_invoke_2 + 372 12 UIKitCore 0x000000018582f378 _UIUpdateSequenceRunNext + 120 13 UIKitCore 0x00000001862640a4 schedulerStepScheduledMainSectionContinue + 56 14 UpdateCycle 0x00000002501912b4 _ZN2UC10DriverCore18continueProcessingEv + 80 15 CoreFoundation 0x000000018041a4ac __CFMachPortPerform + 164 16 CoreFoundation 0x0000000180456aa8 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 56 17 CoreFoundation 0x00000001804560c0 __CFRunLoopDoSource1 + 480 18 CoreFoundation 0x0000000180455188 __CFRunLoopRun + 2100 19 CoreFoundation 0x000000018044fcec _CFRunLoopRunSpecificWithOptions + 496 20 GraphicsServices 0x0000000192a669bc GSEventRunModal + 116 21 UIKitCore 0x0000000186348574 -[UIApplication _run] + 772 22 UIKitCore 0x000000018634c79c UIApplicationMain + 124 23 SwiftUI 0x00000001da58d620 $s7SwiftUI17KitRendererCommon33_ACC2C5639A7D76F611E170E831FCA491LLys5NeverOyXlXpFAESpySpys4Int8VGSgGXEfU_ + 164 24 SwiftUI 0x00000001da58d368 $s7SwiftUI6runAppys5NeverOxAA0D0RzlF + 180 25 SwiftUI 0x00000001da31b42c $s7SwiftUI3AppPAAE4mainyyFZ + 148 26 ShareLinkSecondaryPlacementDemo.deb 0x0000000104d82b0c $s31ShareLinkSecondaryPlacementDemo0abcdE3AppV5$mainyyFZ + 40 27 ShareLinkSecondaryPlacementDemo.deb 0x0000000104d82bb8 __debug_main_executable_dylib_entry_point + 12 28 dyld 0x0000000104cc53d0 start_sim + 20 29 ??? 0x0000000104ff0d54 0x0 + 4378791252 ) libc++abi: terminating due to uncaught exception of type NSException
1
0
82
2d
Capture a List selection AND push a view
I've got a situation where I want the iPad to push an editing view onto the sidebar (like on iPhone) and also display a detail view (no content view). This is working great. However, I need to determine which item from a List in a NavigationSplitView has been selected and pass this to the detail view (the selection is out of scope). This works with the List selection parameter, but the item selected is ONLY selected and the child view in the NavigationLink does not get pushed, nor does the detail view get changed. I either need to figure out a way to capture the selection without the List Selection parameter (Tap Gesture?) or get the navigation to happen even when using the Selection parameter. I'd appreciate some ideas as I'm a newb just learning SwiftUI.
Topic: UI Frameworks SubTopic: SwiftUI
0
0
33
2d
Pickers in toolbar expand its width
With iOS 26 there has been a change in behavior with Pickers in the toolbar. The Picker looks expanded unlike other views such as a Button and Menu. See screenshots below. Is this the intended behavior or a bug? (I already submitted a feedback for this at FB19276474) What Picker looks like in the toolbar: What Button looks like in the toolbar:
0
0
40
3d
SwiftUI recursive list with children: programmatically expand nodes
I have a SwiftUI recursive list, created with the (children:) initializer, just like it's shown in the code example here: https://developer.apple.com/documentation/SwiftUI/List#Creating-hierarchical-lists I would like this tree view to be searchable (i.e a user enters a query into a text field and it searches the entire tree at all levels). Displaying a search result which is not at the top level would require its parents to be programmatically expanded. How to programmatically expand certain levels of such a list?
0
0
39
3d
Preventing crashes with ScrollViewProxy.scrollTo()
I have a search field and a List of search results. As the user types in the search field, the List is updated with new results. Crucially, with each update, I want to reset the List's scroll position back to the top. To achieve this, I'm using the following .onChange() modifier along with a ScrollViewReader: .onChange(of: searchQuery) { _, newQuery in Task { searchResults = await searchLibrary(for: newQuery) scrollViewProxy.scrollTo(0, anchor: .top) } } My List uses index-based IDs, so scrolling to 0 should always go to the first item. The above code works, but crashes if searchResults is empty because there is no item in the List with an ID of 0. (As a side note, it seems rather excessive for the scrollTo() method to trigger a full-on crash just because the ID is not found; I don't think this should be anything more than a warning, or the method should throw an error that can be caught). To work around this, I added an isEmpty check, so we only attempt the scroll if the array is not empty: .onChange(of: searchQuery) { _, newQuery in Task { searchResults = await searchLibrary(for: newQuery) if !searchResults.isEmpty { scrollViewProxy.scrollTo(0, anchor: .top) } } } However, even with this check, I was seeing rare crashes in production, consistent with a race condition. My guess is that when searchResults is updated, the view is not recreated immediately, so if scrollTo() is called too quickly, the List may not yet be seeing the latest update to the searchResults array. I figured that I could try to delay the calling of scrollTo() to give the view time to update: .onChange(of: searchQuery) { _, newQuery in Task { searchResults = await searchLibrary(for: newQuery) if !searchResults.isEmpty { DispatchQueue.main.async { scrollViewProxy.scrollTo(0, anchor: .top) } } } } However, even with this, I've just received a crash report pointing to the same issue (the first in about four months). I'm not able to reproduce the bug myself – so it definitely seems like a rare race condition, probably relating to the timing of view updates. I guess, I can insert another isEmpty check before calling scrollTo(), but I'm starting to wonder if it's even possible to guarantee that the item will be in the List when scrollTo() performs its action, and because this is so hard to reproduce, I can't really test any ideas. Does anyone have any idea how (and at what point) the ScrollViewReader reads the view's current state? What's the right way to approach debugging a problem like this? Moreover, does anyone have any better suggestions about how to handle resetting the List position? The reason I want to do this is because, if the user types, scrolls a bit, and then types some more, the new results appear above the fold where the user can't see them, leading to a confusing experience. I thought about switching to the newer .scrollPosition() modifier, but that's only iOS 18+ and only for ScrollViews, not Lists. Cheers!
Topic: UI Frameworks SubTopic: SwiftUI
0
0
24
3d
SwiftData @Query causes UI Hierarchy crash
Simple code like struct ContentView: View { @Query var items: [Item] var body: some View { VStack { Image(systemName: "globe") .imageScale(.large) .foregroundStyle(.tint) Text("Hello, world!") } .padding() } } causes UI Hierarchy crash, on Simulators, iPhone and Mac I found no solution but use @State with fetch descriptor.
0
0
30
4d
tabBarMinimizeBehavior behavior in iOS 26
I'm trying to revamp the player into a floating style like Apple music. I use tabViewBottomAccessory with tabBarMinimizeBehavior. At the time, I noticed an issue that tabViewBottomAccessory would not automatically collapse when the scroll area was small (but still exceeded the screen height). tabViewBottomAccessory can only be automatically collapsed when the scroll area is large enough. Below is the simplest demo. I'm not sure if it's intentional or if it's a bug. Besides, I wonder if we can control it programmatically(expanded/inline)? struct ContentView: View { var body: some View { TabView { Tab("Numbers", systemImage: "number.circle") { List { // 200 works well, but 20 not ForEach(0..<200) { index in Text("\(index)") } } } } .tabBarMinimizeBehavior(.onScrollDown) .tabViewBottomAccessory { HStack { Text("SwiftUI Demo App") } } } }
1
0
108
5d
How to improve my SwiftUI tvOS app flow?
Hello, I'm thinking about how to improve my main tvOS app flow, naively I want to do something like this: import Combine import SwiftUI enum AppState { case login, onboarding, main } class AppStateManager { let appStatePublisher = PassthroughSubject<AppState, Never>() func updateState(_ appState: AppState) } struct tvOSApp: App { private var appState: AppState = .login private let appStateManager = AppStateManager() var body: some Scene { WindowGroup { ZStack { switch appState { case .login: LoginView() case .onboarding: OnboardingView() case .main: MainView() } } .onReceive(appStateManager.appStatePublisher) { self.appState = $0 } } } } So basically, MainView, OnboardingView and LoginView would be the main navigation views of my app, and the appStateManager would be a dependency passed to each of these views and allowing me to update the currently displayed view in the app. (of course I could use an Environment object instead for a 100% SwiftUI solution). I was wondering, however, if there is a better way to do this, instead of switching in a ZStack, maybe with WindowGroup/Window/Scenes? Thank you for your help!
0
0
39
5d
How to prevent window scene restoration
We have an iOS app running on macOS (not Mac Catalyst). The preferences are in a dedicated UIWindowScene. We don't want this scene to be restored, so when you start the app the preferences shouldn't be visible. How can we prevent the UIWindowScene restoration? Alternatively, if we can't prevent it, how can we ensure the main window scene is in front of the preferences window scene on app start?
Topic: UI Frameworks SubTopic: UIKit Tags:
0
0
31
5d