Provide views, controls, and layout structures for declaring your app's user interface using SwiftUI.

Posts under SwiftUI tag

200 Posts

Post

Replies

Boosts

Views

Activity

NavigationPath.append but .navigationDestination Not Being Called
I am trying to do a bit of fancy navigation in SwiftUI using NavigationPath and am having a problem. I have a root view with includes a button: struct ClassListScreen: View { @Bindable private var router = AppRouter.shared @State private var addCourse: Bool = false ... var body: some View { ... Button("Add Class") { router.currentPath.append(addCourse) }.buttonStyle(.borderedProminent) ... .navigationDestination(for: Bool.self){ _ in ClassAddDialog { course in sortCourses() } } } } router.currentPath is the NavigationPath associated with the operative NavigationStack. (This app has a TabView and each Tab has its own NavigationStack and NavigationPath). Tapping the button correctly opens the ClassAddDialog. In ClassAddDialog is another button: struct ClassAddDialog: View { @Bindable private var router = AppRouter.shared @State private var idString: String = "" ... var body: some View { ... Button("Save") { let course = ... ... (save logic) idString = course.id.uuidString var path = router.currentPath path.removeLast() path.append(idString) router.currentPath = path }.buttonStyle(.borderedProminent) ... .navigationDestination(for: String.self) { str in if let id = UUID(uuidString: str), let course = Course.findByID(id, with: context) { ClassDetailScreen(course: course) } } } } My intent here is that tapping the Save button in ClassAddDialog would pop that view and move directly to the ClassDetailScreen (without returning to the root ClassListScreen). The problem is that the code inside the navigationDestination is NEVER hit. (I.e., a breakpoint on the if let ... statement) never fires. I just end up on a (nearly) blank view with a warning triangle icon in its center. (And yes, the back button takes me to the root, so the ClassAddDialog WAS removed as expected.) And I don't understand why. Can anyone share any insight here?
0
1
105
Oct ’25
Is ContactAccessButton broken?
Simple question - on iOS 26 ContactAccessButton does not appear to show any UI when attempting to search for a contact in either the contact access picker on the ContactAccessButton. This behavior occurs in the Apple provided sample code , as well as a basic example: struct ContentView: View { @State var searchText : String = "" var body: some View { VStack { TextField("Search", text: $searchText) ContactAccessButton( queryString: searchText, ignoredEmails: nil, ignoredPhoneNumbers: nil, approvalCallback: { identifiers in print(identifiers) }) } .padding() } } Am I doing something wrong or is this just not working?
1
0
222
Oct ’25
Scroll TextEditor to cursor position
Hello. Is there a good SwiftUI approach on getting the TextEditor cursor position? I have a TextEditor and sometimes when we have a longer text inside it, the cursor is not seen because the keyboard is above covering the bottom of the TextEditor. I would like to somehow detect the position of the cursor, and if it's on the last line of the TextEditor, scroll to the bottom. I've already checked a bit and didn't find any good method of doing this in SwiftUI. If you have any ideas on how to do this, or even a different method any help would be highly appreciated. Thank you!
1
3
830
Oct ’25
"The compiler is unable to type-check this expression..."
"/Users/rich/Work/IdeaBlitz/IdeaBlitz/IdeaListView.swift:30:25 The compiler is unable to type-check this expression in reasonable time; try breaking up the expression into distinct sub-expressions" Is it just me? I get this on syntax errors, missing commas, missing quotes, and for no particular reason at all that I can see. I don't think I've been able to write a single, simple, SwiftUI view without seeing this multiple times. "Breaking it up" just makes it harder to read. Simple, inline, 2-page views become 8-page, totally unreadable, monstrosities. Am I doing something wrong? Or is this just the state of SwiftUI today? Or is there some way to tell the compiler to take more time on this expression? I mean, if these can be broken up automatically, then why doesn't the compiler to that already?
3
0
340
Oct ’25
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 } } }
5
1
176
Oct ’25
Unable to apply liquid glass effect on popover that is opened from a liquid glass container
When a popover is presented from a view that uses glassEffect(.regular.interactive()), I’m seeing mutually exclusive behavior: either the popover’s chrome (its navigation bar / toolbar) uses Liquid Glass or the originating control keeps its Liquid Glass “morph” behavior — but not both at the same time. There are two ways that I can enable Liquid Glass on the container: Option 1 (background capsule with .glassEffect) → The popover’s toolbar shows Liquid Glass, but the menu button loses its morph effect. Option 2 (.glassEffect applied to the HStack) → The menu button keeps the morph effect, but the popover’s toolbar does not have Liquid Glass. I'm using XCode 26.0.1, with latest iOS 26.0 stable simulator installed. Here's an example code to reproduce the issue: import PlaygroundSupport import SwiftUI // MARK: - TestView struct TestView: View { @State private var isPresented = false var body: some View { VStack { Spacer() HStack { Button("", systemImage: "plus") { isPresented = true } .popover(isPresented: $isPresented) { MyPopover() } Menu { Button("Option 1", action: {}) Button("Option 2", action: {}) Button("Option 3", action: {}) } label: { Image(systemName: "ellipsis") .frame(width: 40, height: 40) } } .padding(.horizontal) // Option 1 - The popover's toolbar will have liquid glass effect, but then the menu button loses liquid glass morph effect .background { Capsule() .fill(Color.white) .glassEffect(.regular.interactive()) } // Option 2 - The popover's toolbar will not have liquid glass effect, but the menu button keeps liquid glass morph effect // .glassEffect(.regular.interactive()) Spacer() } .frame(width: 400, height: 800) } } // MARK: - MyPopover private struct MyPopover: View { var body: some View { NavigationStack { VStack { ScrollView { Text( "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum." ) .padding(.horizontal) } } .navigationTitle("Welcome") .navigationBarTitleDisplayMode(.inline) .toolbar { ToolbarItem(placement: .cancellationAction) { Button("", systemImage: "xmark", action: {}) } } } .presentationCompactAdaptation(.popover) .frame(width: 300, height: 200) } } PlaygroundPage.current.setLiveView( TestView() ) Attached the screenshots for the difference.
1
0
197
Oct ’25
Is it still possible to change the color of unselected icons in a TabView?
Hi. I‘m making an app with SwiftUI for iOS 26, and found that the old ways of changing unselected icons color seem not working as they did in old versions of iOS. I tried these methods: TabView() { Tab { // some view here } label: { Label(title: { Text("something") }, icon: { Image(systemName: "checkmark.seal.fill") .foregroundStyle(.blue) } } } I wrapped Image with an if-else, but itisn't able to change any color even without if; struct ParentView: View { init() { UITabBar.appearance() .unselectedItemTintColor = UIColor.red } var body: some View { TabView() { // some tabs here } } } and an extension of above struct ParentView: View { init() { let tabBarAppearance = UITabBarAppearance() tabBarAppearance.configureWithOpaqueBackground() tabBarAppearance.backgroundColor = UIColor.green tabBarAppearance.stackedLayoutAppearance .selected.titleTextAttributes = [.foregroundColor: UIColor.red] tabBarAppearance.stackedLayoutAppearance.normal .titleTextAttributes = [.foregroundColor: UIColor.black] tabBarAppearance.stackedLayoutAppearance .normal.iconColor = UIColor.black tabBarAppearance.stackedLayoutAppearance .selected.iconColor = UIColor.red UITabBar.appearance() .scrollEdgeAppearance = tabBarAppearance UITabBar.appearance() .standardAppearance = tabBarAppearance UITabBar.appearance() .unselectedItemTintColor = .black } var body: some View { TabView() { // some tabs here } } } I read about this from reddit https://www.reddit.com/r/iOSProgramming/comments/1ftmfoa/tabbartabview_icon_and_text_colors_in_ios_18/, it successfully changes the color of the texts in the tabbar, but not the icons. After these, GitHub Copilot suggested me to draw two versions of icons, for different colors, which does work, but out of my capabilities. Is there any other ways to do this on new systems? Thank you very much for any replies.
1
0
179
Oct ’25
White flash using manageSubscriptionsSheet in SwiftUI
In SwiftUI I am using the manageSubscriptionsSheet modifier to open the iOS subscription screen. When this is presented it immediately flashes a white view and then animated the subscription screen up from the bottom, it looks pretty bad. The view I am calling manageSubscriptionsSheet on is presented in a sheet, so maybe trying to present the subscriptions view as well is causing the visual glitch. Any way to not have this white flashing view when opening the subscription screen?
0
0
161
Oct ’25
Extract Subview option missing in Xcode 26
Hi everyone, I recently updated to Xcode 26.0 and noticed that the “Extract Subview” refactoring option seems to be missing. Now, in Xcode 26, the only options I see under Editor -> Refactor -> are: Extract to Selection File Extract to Method Extract to Variable Extract All Occurrences But there’s no Extract Subview as there was before. Was Extract Subview intentionally removed in Xcode 26? Or is it hidden behind a new menu location or renamed?
5
7
618
Oct ’25
Present confirmationDialog from swipeActions in List
Hello, We use the .confirmationDialog() view modifier to present an alert when deleting an item in a list. Prior to iOS 26, this dialog appeared as an action sheet on iPhone. Following WWDC 25, my understanding is that on iOS 26 the dialog should appear as an action sheet over the originating view on iPhone. This is the behavior we observe in the built-in Messages and Mail apps when deleting an item (see the screenshot below). However, when using .confirmationDialog() on iOS 26, the dialog is displayed as a standard popover on iPhone. I haven’t been able to reproduce the new expected behavior. Here's a sample code: struct ContentView: View { @State var data: [String] = ["A", "B", "C"] @State var confirmationPresented: Bool = false var body: some View { List { ForEach(data, id: \.self) { item in Text(item) .confirmationDialog("Title", isPresented: $confirmationPresented, actions: { Button(action: { }, label: { Text("OK") }) }) .swipeActions { Button("Delete", systemImage: "trash", action: { confirmationPresented.toggle() }) .tint(Color.red) } } } } } Here's the result from this sample code: Is there an additional modifier or configuration required to enable the action sheet presentation on iPhone in iOS 26?
2
1
219
Oct ’25
WKWebView Crashes on iOS During YouTube Playlist Playback
I’m encountering a consistent crash in WebKit when using WKWebView to play a YouTube playlist in my iOS app. Playback starts successfully, but the web process terminates during the second video in the playlist. This only occurs on physical devices, not in the simulator. Here’s a simplified Swift example of my setup: import SwiftUI import WebKit struct ContentView: View { private let playlistID = "PLig2mjpwQBZnghraUKGhCqc9eAy0UbpDN" var body: some View { YouTubeWebView(playlistID: playlistID) .edgesIgnoringSafeArea(.all) } } struct YouTubeWebView: UIViewRepresentable { let playlistID: String func makeUIView(context: Context) -> WKWebView { let config = WKWebViewConfiguration() config.allowsInlineMediaPlayback = true let webView = WKWebView(frame: .zero, configuration: config) webView.scrollView.isScrollEnabled = true let html = """ <!doctype html> <html> <head> <meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0"> <style>body,html{height:100%;margin:0;background:#000}iframe{width:100%;height:100%;border:0}</style> </head> <body> <iframe src="https://www.youtube-nocookie.com/embed/videoseries?list=\(playlistID)&controls=1&rel=0&playsinline=1&iv_load_policy=3" frameborder="0" allow="encrypted-media; picture-in-picture; fullscreen" webkit-playsinline allowfullscreen ></iframe> </body> </html> """ webView.loadHTMLString(html, baseURL: nil) return webView } func updateUIView(_ uiView: WKWebView, context: Context) {} } #Preview { ContentView() } Observed behavior: First video plays without issue. Web process crashes when the second video in the playlist starts. Console logs show WebProcessProxy::didClose and repeated memory status messages. Using ProcessAssertion or background activity does not prevent the crash. Only occurs on physical devices; simulators do not reproduce the issue. Questions: Is there something I should change or add in my WKWebView setup or HTML/iframe to prevent the crash when playing the second video in a playlist on physical iOS devices? Is there an officially supported way to limit memory or prevent WebKit from terminating the web process during multi-video playback? Are there recommended patterns for playing YouTube playlists in a WKWebView on iOS without risking crashes? Any tips for debugging or configuring WKWebView to make it more stable for continuous playlist playback? Thanks in advance for any guidance!
2
0
619
Oct ’25
Crash while presenting popover on toolbar item in MacCatalyst app
struct ContentView: View { @State private var showingPopover:Bool = false private var popOverHeight: CGFloat { return 566 } var body: some View { NavigationStack { VStack { Image(systemName: "globe") .imageScale(.large) .foregroundStyle(.tint) Text("Hello, world!") } .padding() .toolbar { ToolbarItem(placement: .topBarTrailing) { Button { showingPopover = true } label: { Image(systemName: "plus") .font(Font.system(size: 15)) .foregroundColor(Color.red) } .popover(isPresented: $showingPopover) { FTShelfNewNotePopoverView1() .frame(minWidth: 340.0) .frame(height: popOverHeight) } } } } } }
0
0
267
Oct ’25
How can I optimize multilingual string translations in SwiftUI for App Store apps using Localization APIs?
Hi team, I’m developing an iOS app that helps manage and translate multilingual content . The app uses SwiftUI with Localizable.strings and Bundle.localizedString(forKey:). I’m trying to optimize for dynamic language switching inside the app without restarting. I’ve tested various methods like: Text(NSLocalizedString("welcome_text", comment: "")) and some approaches using @Environment(.locale), but the system doesn’t always update views instantly when language changes. Question: What’s the recommended approach (or WWDC reference) for real-time language change handling in SwiftUI apps targeting iOS 18+?
1
0
274
Oct ’25
How to display SegmentControl in tabViewBottomAccessory inline mode like iOS 26 Photos app?
Question I'm trying to replicate the iOS 26 Photos app behavior where a segmented control appears in the tab bar area when scrolling. Specifically, when the tab bar minimizes to inline mode, I want to show a Picker with .segmented style between the minimized tab button and search button. Expected Behavior (iOS 26 Photos App) When scrolling up in the Photos app: Tab bar minimizes to inline mode A segmented control (Years/Months/All) appears in the center Layout: [Tab Button] [Segmented Control] [Search Button] Current Implementation I'm using tabViewBottomAccessory with tabBarMinimizeBehavior: struct PhotosMainView: View { @Environment(ModelData.self) private var modelData @State private var searchText: String = "" var body: some View { @Bindable var modelData = modelData TabView { Tab("Library", systemImage: "photo.on.rectangle") { NavigationStack { PhotosGridView() .navigationTitle("Library") } } Tab("Albums", systemImage: "square.grid.2x2") { NavigationStack { AlbumsGridView() .navigationTitle("Albums") } } Tab("Search", systemImage: "magnifyingglass", role: .search) { NavigationStack { PhotosGridView() .navigationTitle("Search") .searchable(text: $searchText) } } } .tabBarMinimizeBehavior(.onScrollUp) .tabViewBottomAccessory { TimelineAccessoryView() .environment(modelData) } } } struct TimelineAccessoryView: View { @Environment(ModelData.self) private var modelData @Environment(\.tabViewBottomAccessoryPlacement) var placement var body: some View { Group { if let placement = placement { switch placement { case .inline: inlineView case .expanded: expandedView } } } } @ViewBuilder private var inlineView: some View { @Bindable var modelData = modelData Picker("View", selection: $modelData.timelineFilter) { Text("Years").tag(TimelineFilter.year) Text("Months").tag(TimelineFilter.month) Text("All").tag(TimelineFilter.all) } .pickerStyle(.segmented) .frame(maxWidth: 200) } @ViewBuilder private var expandedView: some View { Text("Expanded state") } } Issues Encountered 1. Console logs show placement changes correctly: placement: nil → expanded → inline 2. However, the segmented control doesn't appear visually in inline mode - The accessory view seems to render, but nothing is visible on screen - Only a small empty space appears where the control should be 3. AttributeGraph cycle warnings appear: === AttributeGraph: cycle detected through attribute 27160 === === AttributeGraph: cycle detected through attribute 26304 === What I've Tried 1. ✅ Separating inline/expanded views into @ViewBuilder properties to avoid cycles 2. ✅ Using .onAppear and .onChange for debugging instead of direct prints in body 3. ✅ Confirming placement environment value changes correctly 4. ❌ The segmented control still doesn't display in inline mode Questions 1. Is tabViewBottomAccessory the correct API to achieve this Photos app effect? 2. How should content be structured in .inline placement to display properly between tab button and search? 3. Are there additional modifiers or constraints needed for inline accessories? 4. Is there documentation or sample code showing this pattern? Environment - Xcode 17.0 - iOS 26.0 - iPhone 16 Simulator - SwiftUI Any guidance on the correct approach to implement this would be greatly appreciated. Thank you!
1
0
220
Oct ’25
Fous, FocusState and Architecture
I am currently struggling with resolving what appear to be competing design issues, and (while I may be just demonstrating my own ignorance) I would like to share my thoughts in the hope that you may have useful insights. For purposes of discussion, consider a large and complex data entry screen with multiple sections for input. For all of the usual reasons (such as reuse, performance management, etc) each of these sections is implemented as its own, separately-compiled View. The screen is, then, composed of a sequence of reusable components. However, each of these components has internal structure and may contain multiple focusable elements (and internal use of .onKeyPress(.tab) {...} to navigate internally). And the logic of each component is such that it has an internal @FocusState variable defined with its own unique type. So, obviously what I want is on the one hand, to provide a tab-based navigation scheme for the screen as a whole, where focus moves smoothly from one component's internals to the next component, and on the other hand ,to build components that don't know anything about each other and have no cross-component dependencies, so that they can be freely reused in different situations. And that's where I'm stuck. Since focus state variables for different components can have different types, a single over-arching FocusState passed (as a binding) to each component doesn't seem possible or workable. But I don't know how else to approach this issue. (Note: in UIKit, I've done things like this by direct manipulation of the Responder Chain, but I don't see how to apply this type of thinking to SwiftUI.) Thoughts?
3
0
224
Oct ’25
iOS 26: Navigation bar unexpectedly switches to Light appearance during navigation in Dark Mode
Summary On iOS 26, the navigation bar unexpectedly switches to a Light appearance during/after a view transition while the device/app is in Dark Mode. This seems correlated with applying listStyle(.plain) to a List. Removing .plain prevents the issue, but my app’s layout requires it. Sample code: import SwiftUI @main struct iOS26NavigationTitleSampleApp: App { var body: some Scene { WindowGroup { NavigationStack { ContentView() .navigationTitle("Root") .navigationBarTitleDisplayMode(.inline) } } } } struct ContentView: View { var body: some View { VStack { NavigationLink { ListView() } label: { VStack { Image(systemName: "globe") .imageScale(.large) .foregroundStyle(.tint) Text("Hello, world!") } } } .padding() .toolbar { ToolbarItemGroup(placement: .navigation) { Button("Test") { } Button("Test2") { } } } } } struct ListView: View { var items: [Int] = Array(0..<100) var body: some View { List { ForEach(items.indices, id: \.self) { idx in cell(items[idx]) } } .listStyle(.plain) .toolbar { ToolbarItemGroup(placement: .navigation) { Button("Test") { } Button("Test2") { } } } .navigationTitle("TTT") } private func cell(_ item: Int) -> some View { Text("\(item)") } } Steps to Reproduce: Set the device to Dark Mode. Launch the sample app. → The root view’s navigation bar is in Dark appearance (as expected). Tap “Hello World” to navigate. → On the destination view, the navigation bar becomes Light. Navigate back to the root view. → The root view’s navigation bar now also remains Light. Expected Result The navigation bar should consistently retain the Dark appearance throughout navigation. Notes Removing listStyle(.plain) stops the issue (navigation bar stays Dark). Simulator: Could not reproduce on iOS Simulator. Devices: Reproducible on physical device. Environment Device: iPhone 15 Plus OS: iOS 26 (23A341) Xcode: 26.0 (17A324)
5
0
525
Oct ’25
List's shadow flickering
When Home tab opened, there is some white shadow on the bottom and the top sides of the list. But when switching to other tab or return to Home tab this shadow disappearing for a second and appearing again. Actual for iOS 26.0.1 on simulator and on real device. Below is short example code that can reproduce issue. When change let pages = UIPageViewController(transitionStyle: .scroll, navigationOrientation: .horizontal) to let pages = UIPageViewController(transitionStyle: .pageCurl, navigationOrientation: .horizontal) issue is not reproduced. import SwiftUI @main struct GlassTestApp: App { var body: some Scene { WindowGroup { MainView() .ignoresSafeArea() } } } struct MainView: UIViewControllerRepresentable { func makeUIViewController(context: Context) -> UITabBarController { let controller = UITabBarController() let home = Home() home.tabBarItem = UITabBarItem(title: "Home", image: UIImage(systemName: "house"), tag: 1) let settings = UIHostingController(rootView: Settings()) settings.tabBarItem = UITabBarItem(title: "Settings", image: UIImage(systemName: "gearshape"), tag: 2) controller.viewControllers = [home, settings] return controller } func updateUIViewController(_ uiViewController: UITabBarController, context: Context) { } } class Home: UINavigationController { init() { let pages = UIPageViewController(transitionStyle: .scroll, navigationOrientation: .horizontal) pages.setViewControllers([UIHostingController(rootView: Page1())], direction: .forward, animated: false) super.init(rootViewController: pages) } required init?(coder aDecoder: NSCoder) { fatalError("init(coder:) has not been implemented") } } struct Page1: View { var body: some View { List { ForEach(1...100, id: \.self) { Text("\($0)") } } .listStyle(.plain) } } struct Settings: View { var body: some View { Text("Settings") } }
4
0
284
Oct ’25
Zoom navigation causes the source view to disappear
After returning from the child view to the parent, the latter one will simply disappear. This is the full view. See itemsContent where I perform the navigation. The last tapped rectangle in this example will simply disappear. struct DashboardView: View { @State var viewModel: DahsboardViewModel @Namespace private var namespace var body: some View { ScrollView(.vertical) { LazyVStack(spacing: 24) { ForEach(viewModel.sections) { section in VStack(spacing: 16) { Text(section.title) itemsContent(for: section) } } } } } func itemsContent(for section: DashboardSection) -> some View { ForEach(section.items) { item in NavigationLink { PatternLearningRouter().rootView .id(item.id) .navigationTransition(.zoom(sourceID: item.id, in: namespace)) } label: { Rectangle() .fill(Color.yellow) .frame(width: 80, height: 80) .overlay { Text(item.title) } .matchedTransitionSource(id: item.id, in: namespace) } } } } XCode26 26.0.1(17A400) iPhone 16 Pro, iOS 26.0.1 Note: Only reproduced when I swipe back (not reproducing it when using back button) Only reproduced on real device not simulator I
0
1
87
Oct ’25
I don't want black background in presented sheet
I want a different color, one from my asset catalog, as the background of my first ever swift UI view (and, well, swift, the rest of the app is still obj.c) I've tried putting the color everywhere, but it does't take. I tried with just .red, too to make sure it wasn't me. Does anyone know where I can put a color call that will actually run? Black looks very out of place in my happy app. I spent a lot of time making a custom dark palette. TIA KT @State private var viewModel = ViewModel() @State private var showAddSheet = false var body: some View { ZStack { Color.myCuteBg .ignoresSafeArea(.all) NavigationStack { content .navigationBarTitleDisplayMode(.inline) .toolbar { ToolbarItem(placement: .principal) { Image("cute.image") .font(.system(size: 30)) .foregroundColor(.beigeTitle) } } } .background(Color.myCuteBg) .presentationBackground(.myCuteBg) .sheet(isPresented: $showAddSheet) { AddView() } .environment(viewModel) .onAppear { viewModel.fetchStuff() } } .tint(.cuteColor) } @ViewBuilder var content: some View { if viewModel.list.isEmpty && viewModel.anotherlist.isEmpty { ContentUnavailableView( "No Content", image: "stop", description: Text("Add something here by tapping the + button.") ) } else { contentList } } var contentList: some View { blah blah blah } } First I tried the background, then the presentation background, and finally the Zstack. I hope this is fixed because it's actually fun to build scrollable content and text with swiftUI and I'd been avoiding it for years.
7
0
379
Oct ’25
NavigationPath.append but .navigationDestination Not Being Called
I am trying to do a bit of fancy navigation in SwiftUI using NavigationPath and am having a problem. I have a root view with includes a button: struct ClassListScreen: View { @Bindable private var router = AppRouter.shared @State private var addCourse: Bool = false ... var body: some View { ... Button("Add Class") { router.currentPath.append(addCourse) }.buttonStyle(.borderedProminent) ... .navigationDestination(for: Bool.self){ _ in ClassAddDialog { course in sortCourses() } } } } router.currentPath is the NavigationPath associated with the operative NavigationStack. (This app has a TabView and each Tab has its own NavigationStack and NavigationPath). Tapping the button correctly opens the ClassAddDialog. In ClassAddDialog is another button: struct ClassAddDialog: View { @Bindable private var router = AppRouter.shared @State private var idString: String = "" ... var body: some View { ... Button("Save") { let course = ... ... (save logic) idString = course.id.uuidString var path = router.currentPath path.removeLast() path.append(idString) router.currentPath = path }.buttonStyle(.borderedProminent) ... .navigationDestination(for: String.self) { str in if let id = UUID(uuidString: str), let course = Course.findByID(id, with: context) { ClassDetailScreen(course: course) } } } } My intent here is that tapping the Save button in ClassAddDialog would pop that view and move directly to the ClassDetailScreen (without returning to the root ClassListScreen). The problem is that the code inside the navigationDestination is NEVER hit. (I.e., a breakpoint on the if let ... statement) never fires. I just end up on a (nearly) blank view with a warning triangle icon in its center. (And yes, the back button takes me to the root, so the ClassAddDialog WAS removed as expected.) And I don't understand why. Can anyone share any insight here?
Replies
0
Boosts
1
Views
105
Activity
Oct ’25
Is ContactAccessButton broken?
Simple question - on iOS 26 ContactAccessButton does not appear to show any UI when attempting to search for a contact in either the contact access picker on the ContactAccessButton. This behavior occurs in the Apple provided sample code , as well as a basic example: struct ContentView: View { @State var searchText : String = "" var body: some View { VStack { TextField("Search", text: $searchText) ContactAccessButton( queryString: searchText, ignoredEmails: nil, ignoredPhoneNumbers: nil, approvalCallback: { identifiers in print(identifiers) }) } .padding() } } Am I doing something wrong or is this just not working?
Replies
1
Boosts
0
Views
222
Activity
Oct ’25
Scroll TextEditor to cursor position
Hello. Is there a good SwiftUI approach on getting the TextEditor cursor position? I have a TextEditor and sometimes when we have a longer text inside it, the cursor is not seen because the keyboard is above covering the bottom of the TextEditor. I would like to somehow detect the position of the cursor, and if it's on the last line of the TextEditor, scroll to the bottom. I've already checked a bit and didn't find any good method of doing this in SwiftUI. If you have any ideas on how to do this, or even a different method any help would be highly appreciated. Thank you!
Replies
1
Boosts
3
Views
830
Activity
Oct ’25
"The compiler is unable to type-check this expression..."
"/Users/rich/Work/IdeaBlitz/IdeaBlitz/IdeaListView.swift:30:25 The compiler is unable to type-check this expression in reasonable time; try breaking up the expression into distinct sub-expressions" Is it just me? I get this on syntax errors, missing commas, missing quotes, and for no particular reason at all that I can see. I don't think I've been able to write a single, simple, SwiftUI view without seeing this multiple times. "Breaking it up" just makes it harder to read. Simple, inline, 2-page views become 8-page, totally unreadable, monstrosities. Am I doing something wrong? Or is this just the state of SwiftUI today? Or is there some way to tell the compiler to take more time on this expression? I mean, if these can be broken up automatically, then why doesn't the compiler to that already?
Replies
3
Boosts
0
Views
340
Activity
Oct ’25
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 } } }
Replies
5
Boosts
1
Views
176
Activity
Oct ’25
Unable to apply liquid glass effect on popover that is opened from a liquid glass container
When a popover is presented from a view that uses glassEffect(.regular.interactive()), I’m seeing mutually exclusive behavior: either the popover’s chrome (its navigation bar / toolbar) uses Liquid Glass or the originating control keeps its Liquid Glass “morph” behavior — but not both at the same time. There are two ways that I can enable Liquid Glass on the container: Option 1 (background capsule with .glassEffect) → The popover’s toolbar shows Liquid Glass, but the menu button loses its morph effect. Option 2 (.glassEffect applied to the HStack) → The menu button keeps the morph effect, but the popover’s toolbar does not have Liquid Glass. I'm using XCode 26.0.1, with latest iOS 26.0 stable simulator installed. Here's an example code to reproduce the issue: import PlaygroundSupport import SwiftUI // MARK: - TestView struct TestView: View { @State private var isPresented = false var body: some View { VStack { Spacer() HStack { Button("", systemImage: "plus") { isPresented = true } .popover(isPresented: $isPresented) { MyPopover() } Menu { Button("Option 1", action: {}) Button("Option 2", action: {}) Button("Option 3", action: {}) } label: { Image(systemName: "ellipsis") .frame(width: 40, height: 40) } } .padding(.horizontal) // Option 1 - The popover's toolbar will have liquid glass effect, but then the menu button loses liquid glass morph effect .background { Capsule() .fill(Color.white) .glassEffect(.regular.interactive()) } // Option 2 - The popover's toolbar will not have liquid glass effect, but the menu button keeps liquid glass morph effect // .glassEffect(.regular.interactive()) Spacer() } .frame(width: 400, height: 800) } } // MARK: - MyPopover private struct MyPopover: View { var body: some View { NavigationStack { VStack { ScrollView { Text( "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum." ) .padding(.horizontal) } } .navigationTitle("Welcome") .navigationBarTitleDisplayMode(.inline) .toolbar { ToolbarItem(placement: .cancellationAction) { Button("", systemImage: "xmark", action: {}) } } } .presentationCompactAdaptation(.popover) .frame(width: 300, height: 200) } } PlaygroundPage.current.setLiveView( TestView() ) Attached the screenshots for the difference.
Replies
1
Boosts
0
Views
197
Activity
Oct ’25
Is it still possible to change the color of unselected icons in a TabView?
Hi. I‘m making an app with SwiftUI for iOS 26, and found that the old ways of changing unselected icons color seem not working as they did in old versions of iOS. I tried these methods: TabView() { Tab { // some view here } label: { Label(title: { Text("something") }, icon: { Image(systemName: "checkmark.seal.fill") .foregroundStyle(.blue) } } } I wrapped Image with an if-else, but itisn't able to change any color even without if; struct ParentView: View { init() { UITabBar.appearance() .unselectedItemTintColor = UIColor.red } var body: some View { TabView() { // some tabs here } } } and an extension of above struct ParentView: View { init() { let tabBarAppearance = UITabBarAppearance() tabBarAppearance.configureWithOpaqueBackground() tabBarAppearance.backgroundColor = UIColor.green tabBarAppearance.stackedLayoutAppearance .selected.titleTextAttributes = [.foregroundColor: UIColor.red] tabBarAppearance.stackedLayoutAppearance.normal .titleTextAttributes = [.foregroundColor: UIColor.black] tabBarAppearance.stackedLayoutAppearance .normal.iconColor = UIColor.black tabBarAppearance.stackedLayoutAppearance .selected.iconColor = UIColor.red UITabBar.appearance() .scrollEdgeAppearance = tabBarAppearance UITabBar.appearance() .standardAppearance = tabBarAppearance UITabBar.appearance() .unselectedItemTintColor = .black } var body: some View { TabView() { // some tabs here } } } I read about this from reddit https://www.reddit.com/r/iOSProgramming/comments/1ftmfoa/tabbartabview_icon_and_text_colors_in_ios_18/, it successfully changes the color of the texts in the tabbar, but not the icons. After these, GitHub Copilot suggested me to draw two versions of icons, for different colors, which does work, but out of my capabilities. Is there any other ways to do this on new systems? Thank you very much for any replies.
Replies
1
Boosts
0
Views
179
Activity
Oct ’25
White flash using manageSubscriptionsSheet in SwiftUI
In SwiftUI I am using the manageSubscriptionsSheet modifier to open the iOS subscription screen. When this is presented it immediately flashes a white view and then animated the subscription screen up from the bottom, it looks pretty bad. The view I am calling manageSubscriptionsSheet on is presented in a sheet, so maybe trying to present the subscriptions view as well is causing the visual glitch. Any way to not have this white flashing view when opening the subscription screen?
Replies
0
Boosts
0
Views
161
Activity
Oct ’25
Extract Subview option missing in Xcode 26
Hi everyone, I recently updated to Xcode 26.0 and noticed that the “Extract Subview” refactoring option seems to be missing. Now, in Xcode 26, the only options I see under Editor -> Refactor -> are: Extract to Selection File Extract to Method Extract to Variable Extract All Occurrences But there’s no Extract Subview as there was before. Was Extract Subview intentionally removed in Xcode 26? Or is it hidden behind a new menu location or renamed?
Replies
5
Boosts
7
Views
618
Activity
Oct ’25
Present confirmationDialog from swipeActions in List
Hello, We use the .confirmationDialog() view modifier to present an alert when deleting an item in a list. Prior to iOS 26, this dialog appeared as an action sheet on iPhone. Following WWDC 25, my understanding is that on iOS 26 the dialog should appear as an action sheet over the originating view on iPhone. This is the behavior we observe in the built-in Messages and Mail apps when deleting an item (see the screenshot below). However, when using .confirmationDialog() on iOS 26, the dialog is displayed as a standard popover on iPhone. I haven’t been able to reproduce the new expected behavior. Here's a sample code: struct ContentView: View { @State var data: [String] = ["A", "B", "C"] @State var confirmationPresented: Bool = false var body: some View { List { ForEach(data, id: \.self) { item in Text(item) .confirmationDialog("Title", isPresented: $confirmationPresented, actions: { Button(action: { }, label: { Text("OK") }) }) .swipeActions { Button("Delete", systemImage: "trash", action: { confirmationPresented.toggle() }) .tint(Color.red) } } } } } Here's the result from this sample code: Is there an additional modifier or configuration required to enable the action sheet presentation on iPhone in iOS 26?
Replies
2
Boosts
1
Views
219
Activity
Oct ’25
WKWebView Crashes on iOS During YouTube Playlist Playback
I’m encountering a consistent crash in WebKit when using WKWebView to play a YouTube playlist in my iOS app. Playback starts successfully, but the web process terminates during the second video in the playlist. This only occurs on physical devices, not in the simulator. Here’s a simplified Swift example of my setup: import SwiftUI import WebKit struct ContentView: View { private let playlistID = "PLig2mjpwQBZnghraUKGhCqc9eAy0UbpDN" var body: some View { YouTubeWebView(playlistID: playlistID) .edgesIgnoringSafeArea(.all) } } struct YouTubeWebView: UIViewRepresentable { let playlistID: String func makeUIView(context: Context) -> WKWebView { let config = WKWebViewConfiguration() config.allowsInlineMediaPlayback = true let webView = WKWebView(frame: .zero, configuration: config) webView.scrollView.isScrollEnabled = true let html = """ <!doctype html> <html> <head> <meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0"> <style>body,html{height:100%;margin:0;background:#000}iframe{width:100%;height:100%;border:0}</style> </head> <body> <iframe src="https://www.youtube-nocookie.com/embed/videoseries?list=\(playlistID)&controls=1&rel=0&playsinline=1&iv_load_policy=3" frameborder="0" allow="encrypted-media; picture-in-picture; fullscreen" webkit-playsinline allowfullscreen ></iframe> </body> </html> """ webView.loadHTMLString(html, baseURL: nil) return webView } func updateUIView(_ uiView: WKWebView, context: Context) {} } #Preview { ContentView() } Observed behavior: First video plays without issue. Web process crashes when the second video in the playlist starts. Console logs show WebProcessProxy::didClose and repeated memory status messages. Using ProcessAssertion or background activity does not prevent the crash. Only occurs on physical devices; simulators do not reproduce the issue. Questions: Is there something I should change or add in my WKWebView setup or HTML/iframe to prevent the crash when playing the second video in a playlist on physical iOS devices? Is there an officially supported way to limit memory or prevent WebKit from terminating the web process during multi-video playback? Are there recommended patterns for playing YouTube playlists in a WKWebView on iOS without risking crashes? Any tips for debugging or configuring WKWebView to make it more stable for continuous playlist playback? Thanks in advance for any guidance!
Replies
2
Boosts
0
Views
619
Activity
Oct ’25
Crash while presenting popover on toolbar item in MacCatalyst app
struct ContentView: View { @State private var showingPopover:Bool = false private var popOverHeight: CGFloat { return 566 } var body: some View { NavigationStack { VStack { Image(systemName: "globe") .imageScale(.large) .foregroundStyle(.tint) Text("Hello, world!") } .padding() .toolbar { ToolbarItem(placement: .topBarTrailing) { Button { showingPopover = true } label: { Image(systemName: "plus") .font(Font.system(size: 15)) .foregroundColor(Color.red) } .popover(isPresented: $showingPopover) { FTShelfNewNotePopoverView1() .frame(minWidth: 340.0) .frame(height: popOverHeight) } } } } } }
Replies
0
Boosts
0
Views
267
Activity
Oct ’25
How can I optimize multilingual string translations in SwiftUI for App Store apps using Localization APIs?
Hi team, I’m developing an iOS app that helps manage and translate multilingual content . The app uses SwiftUI with Localizable.strings and Bundle.localizedString(forKey:). I’m trying to optimize for dynamic language switching inside the app without restarting. I’ve tested various methods like: Text(NSLocalizedString("welcome_text", comment: "")) and some approaches using @Environment(.locale), but the system doesn’t always update views instantly when language changes. Question: What’s the recommended approach (or WWDC reference) for real-time language change handling in SwiftUI apps targeting iOS 18+?
Replies
1
Boosts
0
Views
274
Activity
Oct ’25
How to display SegmentControl in tabViewBottomAccessory inline mode like iOS 26 Photos app?
Question I'm trying to replicate the iOS 26 Photos app behavior where a segmented control appears in the tab bar area when scrolling. Specifically, when the tab bar minimizes to inline mode, I want to show a Picker with .segmented style between the minimized tab button and search button. Expected Behavior (iOS 26 Photos App) When scrolling up in the Photos app: Tab bar minimizes to inline mode A segmented control (Years/Months/All) appears in the center Layout: [Tab Button] [Segmented Control] [Search Button] Current Implementation I'm using tabViewBottomAccessory with tabBarMinimizeBehavior: struct PhotosMainView: View { @Environment(ModelData.self) private var modelData @State private var searchText: String = "" var body: some View { @Bindable var modelData = modelData TabView { Tab("Library", systemImage: "photo.on.rectangle") { NavigationStack { PhotosGridView() .navigationTitle("Library") } } Tab("Albums", systemImage: "square.grid.2x2") { NavigationStack { AlbumsGridView() .navigationTitle("Albums") } } Tab("Search", systemImage: "magnifyingglass", role: .search) { NavigationStack { PhotosGridView() .navigationTitle("Search") .searchable(text: $searchText) } } } .tabBarMinimizeBehavior(.onScrollUp) .tabViewBottomAccessory { TimelineAccessoryView() .environment(modelData) } } } struct TimelineAccessoryView: View { @Environment(ModelData.self) private var modelData @Environment(\.tabViewBottomAccessoryPlacement) var placement var body: some View { Group { if let placement = placement { switch placement { case .inline: inlineView case .expanded: expandedView } } } } @ViewBuilder private var inlineView: some View { @Bindable var modelData = modelData Picker("View", selection: $modelData.timelineFilter) { Text("Years").tag(TimelineFilter.year) Text("Months").tag(TimelineFilter.month) Text("All").tag(TimelineFilter.all) } .pickerStyle(.segmented) .frame(maxWidth: 200) } @ViewBuilder private var expandedView: some View { Text("Expanded state") } } Issues Encountered 1. Console logs show placement changes correctly: placement: nil → expanded → inline 2. However, the segmented control doesn't appear visually in inline mode - The accessory view seems to render, but nothing is visible on screen - Only a small empty space appears where the control should be 3. AttributeGraph cycle warnings appear: === AttributeGraph: cycle detected through attribute 27160 === === AttributeGraph: cycle detected through attribute 26304 === What I've Tried 1. ✅ Separating inline/expanded views into @ViewBuilder properties to avoid cycles 2. ✅ Using .onAppear and .onChange for debugging instead of direct prints in body 3. ✅ Confirming placement environment value changes correctly 4. ❌ The segmented control still doesn't display in inline mode Questions 1. Is tabViewBottomAccessory the correct API to achieve this Photos app effect? 2. How should content be structured in .inline placement to display properly between tab button and search? 3. Are there additional modifiers or constraints needed for inline accessories? 4. Is there documentation or sample code showing this pattern? Environment - Xcode 17.0 - iOS 26.0 - iPhone 16 Simulator - SwiftUI Any guidance on the correct approach to implement this would be greatly appreciated. Thank you!
Replies
1
Boosts
0
Views
220
Activity
Oct ’25
Fous, FocusState and Architecture
I am currently struggling with resolving what appear to be competing design issues, and (while I may be just demonstrating my own ignorance) I would like to share my thoughts in the hope that you may have useful insights. For purposes of discussion, consider a large and complex data entry screen with multiple sections for input. For all of the usual reasons (such as reuse, performance management, etc) each of these sections is implemented as its own, separately-compiled View. The screen is, then, composed of a sequence of reusable components. However, each of these components has internal structure and may contain multiple focusable elements (and internal use of .onKeyPress(.tab) {...} to navigate internally). And the logic of each component is such that it has an internal @FocusState variable defined with its own unique type. So, obviously what I want is on the one hand, to provide a tab-based navigation scheme for the screen as a whole, where focus moves smoothly from one component's internals to the next component, and on the other hand ,to build components that don't know anything about each other and have no cross-component dependencies, so that they can be freely reused in different situations. And that's where I'm stuck. Since focus state variables for different components can have different types, a single over-arching FocusState passed (as a binding) to each component doesn't seem possible or workable. But I don't know how else to approach this issue. (Note: in UIKit, I've done things like this by direct manipulation of the Responder Chain, but I don't see how to apply this type of thinking to SwiftUI.) Thoughts?
Replies
3
Boosts
0
Views
224
Activity
Oct ’25
iOS 26: Navigation bar unexpectedly switches to Light appearance during navigation in Dark Mode
Summary On iOS 26, the navigation bar unexpectedly switches to a Light appearance during/after a view transition while the device/app is in Dark Mode. This seems correlated with applying listStyle(.plain) to a List. Removing .plain prevents the issue, but my app’s layout requires it. Sample code: import SwiftUI @main struct iOS26NavigationTitleSampleApp: App { var body: some Scene { WindowGroup { NavigationStack { ContentView() .navigationTitle("Root") .navigationBarTitleDisplayMode(.inline) } } } } struct ContentView: View { var body: some View { VStack { NavigationLink { ListView() } label: { VStack { Image(systemName: "globe") .imageScale(.large) .foregroundStyle(.tint) Text("Hello, world!") } } } .padding() .toolbar { ToolbarItemGroup(placement: .navigation) { Button("Test") { } Button("Test2") { } } } } } struct ListView: View { var items: [Int] = Array(0..<100) var body: some View { List { ForEach(items.indices, id: \.self) { idx in cell(items[idx]) } } .listStyle(.plain) .toolbar { ToolbarItemGroup(placement: .navigation) { Button("Test") { } Button("Test2") { } } } .navigationTitle("TTT") } private func cell(_ item: Int) -> some View { Text("\(item)") } } Steps to Reproduce: Set the device to Dark Mode. Launch the sample app. → The root view’s navigation bar is in Dark appearance (as expected). Tap “Hello World” to navigate. → On the destination view, the navigation bar becomes Light. Navigate back to the root view. → The root view’s navigation bar now also remains Light. Expected Result The navigation bar should consistently retain the Dark appearance throughout navigation. Notes Removing listStyle(.plain) stops the issue (navigation bar stays Dark). Simulator: Could not reproduce on iOS Simulator. Devices: Reproducible on physical device. Environment Device: iPhone 15 Plus OS: iOS 26 (23A341) Xcode: 26.0 (17A324)
Replies
5
Boosts
0
Views
525
Activity
Oct ’25
List's shadow flickering
When Home tab opened, there is some white shadow on the bottom and the top sides of the list. But when switching to other tab or return to Home tab this shadow disappearing for a second and appearing again. Actual for iOS 26.0.1 on simulator and on real device. Below is short example code that can reproduce issue. When change let pages = UIPageViewController(transitionStyle: .scroll, navigationOrientation: .horizontal) to let pages = UIPageViewController(transitionStyle: .pageCurl, navigationOrientation: .horizontal) issue is not reproduced. import SwiftUI @main struct GlassTestApp: App { var body: some Scene { WindowGroup { MainView() .ignoresSafeArea() } } } struct MainView: UIViewControllerRepresentable { func makeUIViewController(context: Context) -> UITabBarController { let controller = UITabBarController() let home = Home() home.tabBarItem = UITabBarItem(title: "Home", image: UIImage(systemName: "house"), tag: 1) let settings = UIHostingController(rootView: Settings()) settings.tabBarItem = UITabBarItem(title: "Settings", image: UIImage(systemName: "gearshape"), tag: 2) controller.viewControllers = [home, settings] return controller } func updateUIViewController(_ uiViewController: UITabBarController, context: Context) { } } class Home: UINavigationController { init() { let pages = UIPageViewController(transitionStyle: .scroll, navigationOrientation: .horizontal) pages.setViewControllers([UIHostingController(rootView: Page1())], direction: .forward, animated: false) super.init(rootViewController: pages) } required init?(coder aDecoder: NSCoder) { fatalError("init(coder:) has not been implemented") } } struct Page1: View { var body: some View { List { ForEach(1...100, id: \.self) { Text("\($0)") } } .listStyle(.plain) } } struct Settings: View { var body: some View { Text("Settings") } }
Replies
4
Boosts
0
Views
284
Activity
Oct ’25
Zoom navigation causes the source view to disappear
After returning from the child view to the parent, the latter one will simply disappear. This is the full view. See itemsContent where I perform the navigation. The last tapped rectangle in this example will simply disappear. struct DashboardView: View { @State var viewModel: DahsboardViewModel @Namespace private var namespace var body: some View { ScrollView(.vertical) { LazyVStack(spacing: 24) { ForEach(viewModel.sections) { section in VStack(spacing: 16) { Text(section.title) itemsContent(for: section) } } } } } func itemsContent(for section: DashboardSection) -> some View { ForEach(section.items) { item in NavigationLink { PatternLearningRouter().rootView .id(item.id) .navigationTransition(.zoom(sourceID: item.id, in: namespace)) } label: { Rectangle() .fill(Color.yellow) .frame(width: 80, height: 80) .overlay { Text(item.title) } .matchedTransitionSource(id: item.id, in: namespace) } } } } XCode26 26.0.1(17A400) iPhone 16 Pro, iOS 26.0.1 Note: Only reproduced when I swipe back (not reproducing it when using back button) Only reproduced on real device not simulator I
Replies
0
Boosts
1
Views
87
Activity
Oct ’25
I don't want black background in presented sheet
I want a different color, one from my asset catalog, as the background of my first ever swift UI view (and, well, swift, the rest of the app is still obj.c) I've tried putting the color everywhere, but it does't take. I tried with just .red, too to make sure it wasn't me. Does anyone know where I can put a color call that will actually run? Black looks very out of place in my happy app. I spent a lot of time making a custom dark palette. TIA KT @State private var viewModel = ViewModel() @State private var showAddSheet = false var body: some View { ZStack { Color.myCuteBg .ignoresSafeArea(.all) NavigationStack { content .navigationBarTitleDisplayMode(.inline) .toolbar { ToolbarItem(placement: .principal) { Image("cute.image") .font(.system(size: 30)) .foregroundColor(.beigeTitle) } } } .background(Color.myCuteBg) .presentationBackground(.myCuteBg) .sheet(isPresented: $showAddSheet) { AddView() } .environment(viewModel) .onAppear { viewModel.fetchStuff() } } .tint(.cuteColor) } @ViewBuilder var content: some View { if viewModel.list.isEmpty && viewModel.anotherlist.isEmpty { ContentUnavailableView( "No Content", image: "stop", description: Text("Add something here by tapping the + button.") ) } else { contentList } } var contentList: some View { blah blah blah } } First I tried the background, then the presentation background, and finally the Zstack. I hope this is fixed because it's actually fun to build scrollable content and text with swiftUI and I'd been avoiding it for years.
Replies
7
Boosts
0
Views
379
Activity
Oct ’25
When debugging with VisionPro in Xcode, the program will block and it will take a long time to execute
After writing the code, when debugging on VisionPro, the program will encounter a blocking situation when running from Xcode to VisionPro. It will take a long time for the execution information to appear on the Xcode console
Replies
1
Boosts
0
Views
449
Activity
Oct ’25