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

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
177
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
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
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
272
Oct ’25
.bottomBar menu button briefly disappears after menu dismissal on iOS 26.1 Seed 2 (23B5059e)
[Also submitted as FB20636175] In iOS 26.1 Seed 2 (23B5059e), ToolbarItem menus with .bottomBar placement cause the toolbar item to disappear and rebuild after the menu is dismissed, instead of smoothly morphing back. The bottom toolbar can take 1–2 seconds to reappear. This also seems to coincide with this console error: Adding 'UIKitToolbar' as a subview of UIHostingController.view is not supported and may result in a broken view hierarchy. Add your view above UIHostingController.view in a common superview or insert it into your SwiftUI content in a UIViewRepresentable instead. This occurs both on device and in a simulator. Sample Project This sample ContentView includes two menu buttons—one in the bottom bar and one in the top bar. Dismissing the bottom bar menu causes a short delay before the button reappears, while the top bar menu behaves normally. struct ContentView: View { var body: some View { NavigationStack { Text("Tap and dismiss both menu buttons and note the difference.") .navigationTitle("BottomBar Menu Issue") .navigationSubtitle("Reproduces on iOS 26.1 Seed 2 (23B5059e)") .toolbar { // Control: top bar trailing menu animates back smoothly ToolbarItem(placement: .topBarTrailing) { Menu { Button("Dismiss", role: .cancel) { } Button("Do Nothing") { } } label: { Label("More", systemImage: "ellipsis.circle") .font(.title3) } } // Repro: delay before menu button reappears after menu dismissal ToolbarItem(placement: .bottomBar) { Menu { Button("Dismiss", role: .cancel) { } Button("Do Nothing") { } } label: { Label("Actions", systemImage: "ellipsis.circle") .font(.title2) } } } } } } Passwords App This can also be seen in iOS 26.1 Seed 2 (23B5059e)'s Passwords app ("All" or "Passcodes" views):
1
2
317
Jan ’26
subscriptionPeriod.unit returns both .week AND .day for weekly subscriptions?
After creating a new weekly subscription option, I get inconsistent results for subscriptionPeriod. In local testing with a synced or a un-synced StoreKit file I am getting unit == .week (as expected) whereas in TestFlight I am getting unit == .day. This makes unit.localizedDescriptionsomewhat unusable in the paywall. Am I missing something? Or is this bug or a limitation of StoreKit and/or TestFlight and/or newly created subscription options? Affected code (in a custom SubscriptionStoreControlStyle): private func priceDisplay(for pickerOption: Configuration.PickerOption) -> String { var result = "" if pickerOption.introductoryOffer != nil { result += NSLocalizedString("then", comment: "") + " " } result += pickerOption.displayPrice if let unit = pickerOption.subscriptionPeriod?.unit { result += " / " + unit.localizedDescription } return result } private func percentageSaved(for pickerOption: Configuration.PickerOption, allOptions: [Product]) -> Int? { guard let subscriptionPeriod = pickerOption.subscriptionPeriod, subscriptionPeriod != .weekly else { return nil } let weeklyOption = allOptions.first { otherOption in otherOption.subscription?.subscriptionPeriod == .weekly } guard let weeklyOption, weeklyOption.price > 0 else { return nil } let percentageSaved = 100 - (pickerOption.price / (weeklyOption.price * 52)) * 100 return Int((percentageSaved as NSNumber).doubleValue) }
0
0
156
Oct ’25
View.navigationLinkIndicatorVisibility(_:) crashes apps running on iOS 18.x
Apps crash on launch when using View.navigationLinkIndicatorVisibility(_:) (which is iOS 17.0+ iPadOS 17.0+ Mac Catalyst 17.0+). Catalyst also crashes. Stack trace starts with: Symbol not found: _$s7SwiftUI17EnvironmentValuesV33_navigationIndicatorVisibilityABIAA0G0OvpMV Xcode 26.0.1 (17A400) iPadOS 18.3.1 (22D8075) It also crashed a user on iOS 18.6.2 macOS 15.6.1 (24G90) FB20596543 import SwiftUI @main struct NavLinkDisabledApp: App { var body: some Scene { WindowGroup { NavigationStack { List { NavigationLink("Text") {} .navigationLinkIndicatorVisibility(.hidden) } } } } }
4
0
153
Oct ’25
SwiftUI animation is laggy in NSStatusItem since macOS 26 Tahoe
My app is a bit of a special case and relies on a custom view in a NSStatusItem. I use a NSHostingView and add it as a subview to my NSStatusItem's .button property. Since macOS 26 Tahoe, even simple animations like a .frame change of a Circle won't animate smoothly even though the same SwiftUI animates normally in a WindowGroup. class AppDelegate: NSObject, NSApplicationDelegate { private let statusItem: NSStatusItem = NSStatusBar.system.statusItem(withLength: NSStatusItem.variableLength) func applicationDidFinishLaunching(_ aNotification: Notification) { let subview = NSHostingView(rootView: AnimationView()) let view = self.statusItem.button view?.addSubview(subview) subview.translatesAutoresizingMaskIntoConstraints = false guard let view = view else { return } NSLayoutConstraint.activate([ subview.centerXAnchor.constraint(equalTo: view.centerXAnchor), subview.centerYAnchor.constraint(equalTo: view.centerYAnchor), subview.widthAnchor.constraint(equalToConstant: 22), subview.heightAnchor.constraint(equalToConstant: 22) ]) } } struct AnimationView: View { @State private var isTapped = false @State private var size: CGSize = .init(width: 4, height: 4) var body: some View { Circle() .fill(.pink) .frame(width: size.width, height: size.height) .frame(width: 20, height: 20) // .frame(maxHeight: .infinity) // .padding(.horizontal, 9) // .frame(height: 22) .contentShape(Rectangle()) // .background(Color.blue.opacity(0.5)) .onTapGesture { withAnimation(.interactiveSpring(response: 0.85, dampingFraction: 0.26, blendDuration: 0.45)) { // withAnimation(.spring()) { if isTapped { size = .init(width: 4, height: 4) } else { size = .init(width: 16, height: 16) } } isTapped.toggle() }} } Example project: https://app.box.com/s/q28upunrgkxyyd97ovslgud9yitqaxfk
0
0
109
Oct ’25
Safari-like toolbar in visionOS
I like the toolbar visionOS's Safari uses for back & forward page, share, etc. It floats above the window. My attempt to do this with ornaments isn't as satisfying as they partially cover the window. My attempts with toolbar haven't produced visible results. Is this Safari-style toolbar for visionOS exposed by Apple in the API's? If so, could someone point me to documentation or sample code? Thanks!
1
0
266
Oct ’25
Foundation Models inside of DeviceActivityReport?
Pretty much as per the title and I suspect I know the answer. Given that Foundation Models run on device, is it possible to use Foundation Models framework inside of a DeviceActivityReport? I've been tinkering with it, and all I get is errors and "Sandbox restrictions". Am I missing something? Seems like a missed trick to utilise on device AI/ML with other frameworks.
1
0
523
Oct ’25
SwiftUI macOS Preview Crash When Using Custom Row Directly Inside List
I’ve hit a strange SwiftUI preview crash that happens on macOS previews when using a view inside a List’s ForEach, resulting in the error Fatal Error in TableViewListCore_Mac2.swift. Only crashes macOS preview - iPhone/iPad preview doesn't crash. Doesn't crash when actually running the app. Here’s a minimal reproducible example, causing the preview to crash. XCode: Version 26.0.1 (17A400) MacOS: 26.0.1 (25A362) import SwiftUI struct Item: Identifiable { let id = UUID() let name: String } struct ItemRow: View { let item: Item var body: some View { HStack { Button(action: {}) { Image(systemName: "play") } Text(item.name) Spacer() ProgressView() } } } struct ContentView: View { @State private var items = [ Item(name: "Item A"), Item(name: "Item B"), ] var body: some View { List { ForEach(items) { item in ItemRow(item: item) } } } } #Preview("Content view") { ContentView() } #Preview("Item row") { ItemRow(item: Item(name: "Item A")) } If I wrap the row in a container, like this: ForEach(items) { item in ZStack { ItemRow(item: item) } } the crash seems to disappear. Has anyone else seen this behavior? What might I be doing wrong? Any ideas about what could be causing this?
1
1
226
Oct ’25
How to bind AppKit window to Observable viewmodel using SwiftUI app life cycle
Hey everyone. I have a macOS app written in SwiftUI. I have multiple SwiftUI Scenes and Views, but needed to write one specific window in AppKit (an NSPanel, to be specific). The problem I'm facing is- I'm not sure how to incorporate this NSPanel with the rest of my SwiftUI/Observable code. I'm relying on the SwiftUI app cycle. For example, I have a boolean in my view model (observation tracked). I'd like to use this boolean to hide/unhide my NSPanel. Any way to cleanly hook into the viewmodel, or onto some specific observable variables would be very very helpful. Thank you everyone.
1
0
196
Oct ’25
Custom Cameras in RealityKit
Hi all, I've developed some code that enables an arcball camera interaction with my scene. I've done this using components and systems. The implementation feels a bit messy as I've got gesture code on my realityView, and then a bunch of other code that uses those gesture inputs in my component and system. Is there a demo app, or some example code that shows a nice way to encapsulate these things in to one item for custom cameras, something like Apple's .realityViewCameraControls(.orbit) If not can anyone recommend an approach to take?
0
0
303
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
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
177
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
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
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
272
Activity
Oct ’25
.bottomBar menu button briefly disappears after menu dismissal on iOS 26.1 Seed 2 (23B5059e)
[Also submitted as FB20636175] In iOS 26.1 Seed 2 (23B5059e), ToolbarItem menus with .bottomBar placement cause the toolbar item to disappear and rebuild after the menu is dismissed, instead of smoothly morphing back. The bottom toolbar can take 1–2 seconds to reappear. This also seems to coincide with this console error: Adding 'UIKitToolbar' as a subview of UIHostingController.view is not supported and may result in a broken view hierarchy. Add your view above UIHostingController.view in a common superview or insert it into your SwiftUI content in a UIViewRepresentable instead. This occurs both on device and in a simulator. Sample Project This sample ContentView includes two menu buttons—one in the bottom bar and one in the top bar. Dismissing the bottom bar menu causes a short delay before the button reappears, while the top bar menu behaves normally. struct ContentView: View { var body: some View { NavigationStack { Text("Tap and dismiss both menu buttons and note the difference.") .navigationTitle("BottomBar Menu Issue") .navigationSubtitle("Reproduces on iOS 26.1 Seed 2 (23B5059e)") .toolbar { // Control: top bar trailing menu animates back smoothly ToolbarItem(placement: .topBarTrailing) { Menu { Button("Dismiss", role: .cancel) { } Button("Do Nothing") { } } label: { Label("More", systemImage: "ellipsis.circle") .font(.title3) } } // Repro: delay before menu button reappears after menu dismissal ToolbarItem(placement: .bottomBar) { Menu { Button("Dismiss", role: .cancel) { } Button("Do Nothing") { } } label: { Label("Actions", systemImage: "ellipsis.circle") .font(.title2) } } } } } } Passwords App This can also be seen in iOS 26.1 Seed 2 (23B5059e)'s Passwords app ("All" or "Passcodes" views):
Replies
1
Boosts
2
Views
317
Activity
Jan ’26
MapPolyline and MapPolygon not visible on simulator
My app uses SwiftUI Map and draws Markers, MapPolyline and MapPolygons over it. These all work on actual devices. On the iOS 26.0.1 Simulator running on macOS 26.0.1 Polylines and Polygons do now show. Do others see the same thing?
Replies
3
Boosts
0
Views
277
Activity
Dec ’25
subscriptionPeriod.unit returns both .week AND .day for weekly subscriptions?
After creating a new weekly subscription option, I get inconsistent results for subscriptionPeriod. In local testing with a synced or a un-synced StoreKit file I am getting unit == .week (as expected) whereas in TestFlight I am getting unit == .day. This makes unit.localizedDescriptionsomewhat unusable in the paywall. Am I missing something? Or is this bug or a limitation of StoreKit and/or TestFlight and/or newly created subscription options? Affected code (in a custom SubscriptionStoreControlStyle): private func priceDisplay(for pickerOption: Configuration.PickerOption) -> String { var result = "" if pickerOption.introductoryOffer != nil { result += NSLocalizedString("then", comment: "") + " " } result += pickerOption.displayPrice if let unit = pickerOption.subscriptionPeriod?.unit { result += " / " + unit.localizedDescription } return result } private func percentageSaved(for pickerOption: Configuration.PickerOption, allOptions: [Product]) -> Int? { guard let subscriptionPeriod = pickerOption.subscriptionPeriod, subscriptionPeriod != .weekly else { return nil } let weeklyOption = allOptions.first { otherOption in otherOption.subscription?.subscriptionPeriod == .weekly } guard let weeklyOption, weeklyOption.price > 0 else { return nil } let percentageSaved = 100 - (pickerOption.price / (weeklyOption.price * 52)) * 100 return Int((percentageSaved as NSNumber).doubleValue) }
Replies
0
Boosts
0
Views
156
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
Long hang in SwiftUI Dev
Why is there always such a long hang when first switching tabs or popping up the keyboard in SwiftUI Development?
Replies
2
Boosts
0
Views
147
Activity
Oct ’25
View.navigationLinkIndicatorVisibility(_:) crashes apps running on iOS 18.x
Apps crash on launch when using View.navigationLinkIndicatorVisibility(_:) (which is iOS 17.0+ iPadOS 17.0+ Mac Catalyst 17.0+). Catalyst also crashes. Stack trace starts with: Symbol not found: _$s7SwiftUI17EnvironmentValuesV33_navigationIndicatorVisibilityABIAA0G0OvpMV Xcode 26.0.1 (17A400) iPadOS 18.3.1 (22D8075) It also crashed a user on iOS 18.6.2 macOS 15.6.1 (24G90) FB20596543 import SwiftUI @main struct NavLinkDisabledApp: App { var body: some Scene { WindowGroup { NavigationStack { List { NavigationLink("Text") {} .navigationLinkIndicatorVisibility(.hidden) } } } } }
Replies
4
Boosts
0
Views
153
Activity
Oct ’25
SwiftUI animation is laggy in NSStatusItem since macOS 26 Tahoe
My app is a bit of a special case and relies on a custom view in a NSStatusItem. I use a NSHostingView and add it as a subview to my NSStatusItem's .button property. Since macOS 26 Tahoe, even simple animations like a .frame change of a Circle won't animate smoothly even though the same SwiftUI animates normally in a WindowGroup. class AppDelegate: NSObject, NSApplicationDelegate { private let statusItem: NSStatusItem = NSStatusBar.system.statusItem(withLength: NSStatusItem.variableLength) func applicationDidFinishLaunching(_ aNotification: Notification) { let subview = NSHostingView(rootView: AnimationView()) let view = self.statusItem.button view?.addSubview(subview) subview.translatesAutoresizingMaskIntoConstraints = false guard let view = view else { return } NSLayoutConstraint.activate([ subview.centerXAnchor.constraint(equalTo: view.centerXAnchor), subview.centerYAnchor.constraint(equalTo: view.centerYAnchor), subview.widthAnchor.constraint(equalToConstant: 22), subview.heightAnchor.constraint(equalToConstant: 22) ]) } } struct AnimationView: View { @State private var isTapped = false @State private var size: CGSize = .init(width: 4, height: 4) var body: some View { Circle() .fill(.pink) .frame(width: size.width, height: size.height) .frame(width: 20, height: 20) // .frame(maxHeight: .infinity) // .padding(.horizontal, 9) // .frame(height: 22) .contentShape(Rectangle()) // .background(Color.blue.opacity(0.5)) .onTapGesture { withAnimation(.interactiveSpring(response: 0.85, dampingFraction: 0.26, blendDuration: 0.45)) { // withAnimation(.spring()) { if isTapped { size = .init(width: 4, height: 4) } else { size = .init(width: 16, height: 16) } } isTapped.toggle() }} } Example project: https://app.box.com/s/q28upunrgkxyyd97ovslgud9yitqaxfk
Replies
0
Boosts
0
Views
109
Activity
Oct ’25
Safari-like toolbar in visionOS
I like the toolbar visionOS's Safari uses for back & forward page, share, etc. It floats above the window. My attempt to do this with ornaments isn't as satisfying as they partially cover the window. My attempts with toolbar haven't produced visible results. Is this Safari-style toolbar for visionOS exposed by Apple in the API's? If so, could someone point me to documentation or sample code? Thanks!
Replies
1
Boosts
0
Views
266
Activity
Oct ’25
Ghost Padding on NavigationBarPlatterContainer
Hello, I have a SwiftUI View sitting in the UIHosting view controller. On rotation to landscape, the system would add padding to the toolbar. I presume it's the nav bar. Anyone experienced this? What would be this space? padding? content margin?
Replies
3
Boosts
0
Views
264
Activity
Jan ’26
Foundation Models inside of DeviceActivityReport?
Pretty much as per the title and I suspect I know the answer. Given that Foundation Models run on device, is it possible to use Foundation Models framework inside of a DeviceActivityReport? I've been tinkering with it, and all I get is errors and "Sandbox restrictions". Am I missing something? Seems like a missed trick to utilise on device AI/ML with other frameworks.
Replies
1
Boosts
0
Views
523
Activity
Oct ’25
Weird behavior with ContentUnavailableView
Hey there, does someone know why the ContentUnavailableView is behaving differently on iOS 26 than in iOS 18 but the code is the same?
Replies
2
Boosts
0
Views
182
Activity
Oct ’25
SwiftUI macOS Preview Crash When Using Custom Row Directly Inside List
I’ve hit a strange SwiftUI preview crash that happens on macOS previews when using a view inside a List’s ForEach, resulting in the error Fatal Error in TableViewListCore_Mac2.swift. Only crashes macOS preview - iPhone/iPad preview doesn't crash. Doesn't crash when actually running the app. Here’s a minimal reproducible example, causing the preview to crash. XCode: Version 26.0.1 (17A400) MacOS: 26.0.1 (25A362) import SwiftUI struct Item: Identifiable { let id = UUID() let name: String } struct ItemRow: View { let item: Item var body: some View { HStack { Button(action: {}) { Image(systemName: "play") } Text(item.name) Spacer() ProgressView() } } } struct ContentView: View { @State private var items = [ Item(name: "Item A"), Item(name: "Item B"), ] var body: some View { List { ForEach(items) { item in ItemRow(item: item) } } } } #Preview("Content view") { ContentView() } #Preview("Item row") { ItemRow(item: Item(name: "Item A")) } If I wrap the row in a container, like this: ForEach(items) { item in ZStack { ItemRow(item: item) } } the crash seems to disappear. Has anyone else seen this behavior? What might I be doing wrong? Any ideas about what could be causing this?
Replies
1
Boosts
1
Views
226
Activity
Oct ’25
How to bind AppKit window to Observable viewmodel using SwiftUI app life cycle
Hey everyone. I have a macOS app written in SwiftUI. I have multiple SwiftUI Scenes and Views, but needed to write one specific window in AppKit (an NSPanel, to be specific). The problem I'm facing is- I'm not sure how to incorporate this NSPanel with the rest of my SwiftUI/Observable code. I'm relying on the SwiftUI app cycle. For example, I have a boolean in my view model (observation tracked). I'd like to use this boolean to hide/unhide my NSPanel. Any way to cleanly hook into the viewmodel, or onto some specific observable variables would be very very helpful. Thank you everyone.
Replies
1
Boosts
0
Views
196
Activity
Oct ’25
Is there a native iOS swiftui component for these email filter tabs?
I was looking at the new iOS 26 Mail app and it has these tab/filters of some sort and I was wondering if there is a default API/code in swiftui that I am supposed to be using. Looked everywhere for this, thank you!!
Replies
3
Boosts
0
Views
113
Activity
Oct ’25
Custom Cameras in RealityKit
Hi all, I've developed some code that enables an arcball camera interaction with my scene. I've done this using components and systems. The implementation feels a bit messy as I've got gesture code on my realityView, and then a bunch of other code that uses those gesture inputs in my component and system. Is there a demo app, or some example code that shows a nice way to encapsulate these things in to one item for custom cameras, something like Apple's .realityViewCameraControls(.orbit) If not can anyone recommend an approach to take?
Replies
0
Boosts
0
Views
303
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