Search results for

“swiftui”

17,491 results found

Post

Replies

Boosts

Views

Activity

Reply to Push new views to sidebar when using NavigationPath
Hello @agorski, Thank you for your post. SwiftUI's NavigationSplitView is designed to catch and route links to content or detail. If using these columns don't work for you, create a sidebar that manages its own state: struct SidebarView: View { @State private var selected: ... Or use a different navigation design pattern that does not route links to detail. In my testing, I was able to get a TabView or the following code to code to work: enum Item: String, CaseIterable { case indigoView, tealView, orangeView, pinkView, greenView, purpleView, yellowView var color: Color { switch self { case .indigoView: .indigo case .tealView: .teal case .orangeView: .orange case .pinkView: .pink case .greenView: .green case .purpleView: .purple case .yellowView: .yellow } } } struct ContentView: View { var body: some View { NavigationSplitView { SidebarView() } detail: { ContentUnavailableView(Static Detail View, systemImage: paintpalette) } } } struct SidebarView: View { var body: some View { NavigationStack { List(
Topic: UI Frameworks SubTopic: SwiftUI
Jun ’26
Reply to Different keyboards show up for KeyboardType .decimalPad
First of all, thank you very much for replying on my thread :) I have prepared two code snippets: The first one is a very simple one that should demonstrate my problem pretty straightforward struct ContentView: View { @State private var text: String = var body: some View { Form { Section { LabeledContent( content: { TextField(Text, text: $text) .keyboardType(.decimalPad) }, label: { Text(Text) } ) } } } } A more sophisticated approach from my project where i specifically saw the problem (as both show the same behavior, i think both might be related) import SwiftUI struct Area { var length: Double? var width: Double? var areaString: String { guard let l = length, let w = width else { return - } return String(format: %.1f cm², l * w) } } private enum AreaAttribute: Hashable { case length, width var label: LocalizedStringKey { switch self { case .length: Length case .width: Width } } } struct ContentView: View { @State private var area: Area = Area() @FocusState private var focused: AreaAttribute? var
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Jun ’26
Screen recording shows iOS 26 navigation/sheet transition corner-rounding
When taking a recording of my app on simulator or iPhone, the recording shows the bottom corners of content go from rounded to square during normal push and sheet transitions. Steps to reproduce: Create a new SwiftUI app and use the attached content view. Run on an iOS 26 Simulator. Start a Simulator screen recording. Tap a row to push, and tap Filter to present the sheet. Stop the recording and play it back frame by frame. You should be able to see the bottom corners round and go to square during the screen navigation. Question: Is there a bug when recording the apps on iOS 26? Configuration: Xcode 26.4.1 iOS 26 Simulator — iPhone 17 Pro Real device: iPhone 16 Pro Max Attachments: ContentView Link to the recording: https://drive.google.com/file/d/1HIwGXC39EVTbRVhJWBdFTJYCENuLxcc_/view?usp=drive_link For Reference: https://developer.apple.com/forums/thread/792662
0
0
65
Jun ’26
Push new views to sidebar when using NavigationPath
I have an existing app that uses NavigationSplitView with a detail view that is never changed and just updates to show changes in data. All navigation changes the sidebar only using NavigationLinks with .isDetailLink(false). Now I'm wanting to use NavigationPath with a simple router and enums. import SwiftUI @main struct NavRouterApp: App { @State private var router = Router() var body: some Scene { WindowGroup { NavigationStack(path: $router.navPath) { ContentView() .navigationDestination(for: AppRoute.self) { route in switch route { case .citizens: ContentView() .environment(router) case .citizen: EmptyView() .environment(router) case .tasform2: TASForm2View() .environment(router) case .start: StartView() .environment(router) case .editcharacteristics: EmptyView() .environment(router) case .basicdata(let citizen): BasicDataView(citizen: citizen) .environment(router) .navigationBarBackButtonHidden(true) case .characteristics: EmptyView() .environment(router) } } } .environment(router) } } } The prob
Topic: UI Frameworks SubTopic: SwiftUI
6
0
213
Jun ’26
Simulator screen recording shows iOS 26 navigation/sheet transition corner-rounding that is not visible on device
On iOS 26, a Simulator screen recording shows the bottom corners of content go from rounded to square during normal push and sheet transitions. This happens on the simulator, but I don't see this on a real iPhone. Steps to reproduce: Create a new SwiftUI app and use the attached content view. Run on an iOS 26 Simulator. Start a Simulator screen recording. Tap a row to push, and tap Filter to present the sheet. Stop the recording and play it back frame by frame. Run the same app on a real iPhone and watch the transitions live. Question: Is this a new feature or a simulator bug? Configuration: Xcode 26.4.1 iOS 26 Simulator — iPhone 17 Pro Real device: iPhone 16 Pro Max Attachments: ContentView
0
0
49
Jun ’26
Delay when using ResultsObserver over @Query?
I was testing how to use ResultsObserver on a ViewModel in SwiftData. In Xcode 27, Developer v1, I have the following view import SwiftUI import SwiftData @Model class TaskItem { var name: String var priority: Int init(name: String, priority: Int) { self.name = name self.priority = priority } } @Observable @MainActor class RandomViewModel { let observer: ResultsObserver @ObservationIgnored private var token: ObservationTracking.Token? var tasks: FetchResultsCollection { observer.results } init(context: ModelContext) { let descriptor = FetchDescriptor( sortBy: [SortDescriptor(.name, order: .reverse)] ) observer = try! ResultsObserver(fetchDescriptor: descriptor, modelContext: context) } } struct RandomView: View { @State var viewModel: RandomViewModel? @Environment(.modelContext) private var modelContext var body: some View { VStack { if let viewModel { List(viewModel.tasks) { foo in Text(foo.name) } .toolbar { ToolbarItem(placement: .primaryAction) { Button(Add Task) { let task = TaskItem(name: ZZ Ne
1
0
915
Jun ’26
iOS 27 / SwiftUI — Search tab .prominent doesn't morph on activation (field goes to top, tabs don't collapse)
I'm building an app with Xcode 27. I had trouble getting the tab bar to detach the search button onto the trailing side. I found that the search behaviour now works through the new .prominent treatment on iOS 27 (with Tab(role: .search)), and the detached button now displays correctly. My remaining problem is the activation behaviour. Expected (as in the system Phone / News / App Store apps): tapping the search button morphs the tab bar — the other tabs collapse into a single leading button and the search field expands at the bottom, centered. Actual: tapping the search tab pushes the search field to the top of the screen, attached to the navigation bar, with no morph animation and no tab collapse. Setup: Xcode 27.0 beta, iOS 27.0 on a physical iPhone Air Same with the Simulator (by the way... i also have some terrible lag with my app on Simulator + my iPhone even with a release version, but not throught TestFlight... strange...) 3 standard tabs + 1 search tab Single .searchable(text:) applied directly on the
Topic: UI Frameworks SubTopic: SwiftUI
1
0
152
Jun ’26
EnvironmentBlendingComponent(.occluded(by: .surroundings)) culling entities entirely?
Hi there! While building my visionOS app, I’ve encountered some strange behaviour with EnvironmentBlendingComponent. Entities using .occluded(by: .surroundings) are culled entirely whenever a Mac Virtual Display or Apple Immersive Environment is behind them, regardless of the entities’ actual depth, and even when the environment is set to coexist. This feels like it could be a bug, although I’m fairly new to visionOS development, so I may be missing something! In a .mixed immersive space with plain passthrough, the component behaves as I would expect: an entity is occluded accurately when a real-world object is placed in front of it. However, when either of the following is visible behind the entity: a Mac Virtual Display window; or an Apple Immersive Environment enabled using the Digital Crown, the entity carrying EnvironmentBlendingComponent disappears completely. This happens even when the entity is physically closer to the viewer than the virtual surface. An otherwise identical entity without the componen
3
0
484
Jun ’26
AVSpeechSynthesizer executes utterances out of order
In previous releases of the os, AVSpeechSynthesizer executed utterances in the order that were enqueued - this is no longer the case. The following snippet should read the numbers 0 to 100 in order, instead it is read (as far as I can tell) randomly. I am unsure is this was an intentional change by Apple, if it was, this was not communicated effectively to developers. import SwiftUI import AVFoundation @main struct MyApp: App { var body: some Scene { WindowGroup { ContentView() } } } struct ContentView: View { let synthesiser = AVSpeechSynthesizer() var body: some View { Button(Synthesise) { for i in 0...100 { let utterance = AVSpeechUtterance(string: i.formatted()) synthesiser.speak(utterance) } } } } #Preview { ContentView() } FB23194665
1
0
487
Jun ’26
Reply to Request for VisionOS Image Presentation features
Sure thing, @RadicalEye. I'm glad you were able to properly scale the spatial image in your scene. As for your other questions, Feedback remains the most effective way to request enhancements in behavior. Once filed, please post the FB number here. In the interim, I'll note that the aforementioned ImagePresentationComponent sample uses both OrnamentAttachmentAnchor and position(relativeTo:) to position its content. As for layout in volumetric windows, Meet SwiftUI spatial layout (WWDC25) offers a helpful survey of current capabilities.
Jun ’26
Liquid Glass tab bar doesn't update its background on tab switch until I scroll — expected? Workaround?
Hi, On iOS 26 I'm seeing a behavior with the new Liquid Glass tab bar in SwiftUI and I can't tell if it's expected or if there's a supported workaround. When I switch tabs in a TabView, the floating Liquid Glass tab bar keeps the glass appearance it derived from the previous tab's content. It only refreshes to match the newly selected tab once I scroll the new tab's scroll view — even by a single point. In Apple's own apps (e.g. Home) the bar updates immediately on tab change, which makes me think this isn't intended. I reduced it to a minimal example — no images, no glassEffect, no NavigationStack, just gradients: struct ContentView: View { enum TabID: Hashable { case blue, green, dark } @State private var selection: TabID = .blue var body: some View { TabView(selection: $selection) { Tab(Blue, systemImage: drop.fill, value: .blue) { Page(colors: [.blue, .indigo]) } Tab(Green, systemImage: leaf.fill, value: .green) { Page(colors: [.green, .teal]) } Tab(Dark, systemImage: moon.fill, value: .dark) { P
0
0
371
Jun ’26
WeatherKit JWT permission error even though entitlement and provisioning profile appear correct
Hi Apple Developer Support / WeatherKit team, I’m seeing WeatherKit fail on a physical iPhone with what appears to be a JWT / permission issue, even though the app appears to be correctly configured and signed with the WeatherKit entitlement. App / project context: App name: Signals Platform: iOS Framework: SwiftUI WeatherKit usage: Native WeatherKit framework, using WeatherService.shared.weather(for:) Purpose: Showing a small morning weather summary inside the app What I have already verified: Active Apple Developer Program membership WeatherKit capability enabled for the App ID in Apple Developer Portal WeatherKit capability enabled in the App Capabilities tab WeatherKit capability added in Xcode Signing & Capabilities Automatic signing enabled Built and tested on a physical iPhone device Location permission is requested and granted The app binary appears to include the WeatherKit entitlement The embedded provisioning profile appears to include the WeatherKit entitlement Issue: WeatherKit still
3
0
254
Jun ’26
MapKit MapCamera
SwiftUI Map with MapCamera jerks on every GPS update instead of animating smoothly I'm trying to make camera to follow the user smoothly during navigation using MapCamera with heading and pitch, similar to Apple Maps or Google Maps. The camera updates on every GPS tick but instead of animating smoothly between positions it jerks , it snaps to the new position, pauses, snaps again, pauses...terrible UX. The blue user location (UserAnnotation) puck moves completely smoothly. Only the camera jerks I have tried all sort of animations and interpolation you may think of. Something is just not right, must be something missing from the puzzle. I have prepared a minimal reproducible example so you can copy and paste the only thing needed is to add the Privacy - Location When In Use Usage Description Run in Simulator, go to Features > Location > Freeway Drive and tap on Track then you'll notice how camera is following then stop then following and stops again Don't bother using AI, he has no clue what's t
0
0
129
Jun ’26
Reply to Push new views to sidebar when using NavigationPath
Hello @agorski, Thank you for your post. SwiftUI's NavigationSplitView is designed to catch and route links to content or detail. If using these columns don't work for you, create a sidebar that manages its own state: struct SidebarView: View { @State private var selected: ... Or use a different navigation design pattern that does not route links to detail. In my testing, I was able to get a TabView or the following code to code to work: enum Item: String, CaseIterable { case indigoView, tealView, orangeView, pinkView, greenView, purpleView, yellowView var color: Color { switch self { case .indigoView: .indigo case .tealView: .teal case .orangeView: .orange case .pinkView: .pink case .greenView: .green case .purpleView: .purple case .yellowView: .yellow } } } struct ContentView: View { var body: some View { NavigationSplitView { SidebarView() } detail: { ContentUnavailableView(Static Detail View, systemImage: paintpalette) } } } struct SidebarView: View { var body: some View { NavigationStack { List(
Topic: UI Frameworks SubTopic: SwiftUI
Replies
Boosts
Views
Activity
Jun ’26
Reply to Different keyboards show up for KeyboardType .decimalPad
First of all, thank you very much for replying on my thread :) I have prepared two code snippets: The first one is a very simple one that should demonstrate my problem pretty straightforward struct ContentView: View { @State private var text: String = var body: some View { Form { Section { LabeledContent( content: { TextField(Text, text: $text) .keyboardType(.decimalPad) }, label: { Text(Text) } ) } } } } A more sophisticated approach from my project where i specifically saw the problem (as both show the same behavior, i think both might be related) import SwiftUI struct Area { var length: Double? var width: Double? var areaString: String { guard let l = length, let w = width else { return - } return String(format: %.1f cm², l * w) } } private enum AreaAttribute: Hashable { case length, width var label: LocalizedStringKey { switch self { case .length: Length case .width: Width } } } struct ContentView: View { @State private var area: Area = Area() @FocusState private var focused: AreaAttribute? var
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Jun ’26
Reply to SwiftUI TextField clearbutton how?
TIL, SwiftUI was released 7 years ago and TextField does support an API equivalent to UIKit's UITextField.clearButtonMode.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Jun ’26
Screen recording shows iOS 26 navigation/sheet transition corner-rounding
When taking a recording of my app on simulator or iPhone, the recording shows the bottom corners of content go from rounded to square during normal push and sheet transitions. Steps to reproduce: Create a new SwiftUI app and use the attached content view. Run on an iOS 26 Simulator. Start a Simulator screen recording. Tap a row to push, and tap Filter to present the sheet. Stop the recording and play it back frame by frame. You should be able to see the bottom corners round and go to square during the screen navigation. Question: Is there a bug when recording the apps on iOS 26? Configuration: Xcode 26.4.1 iOS 26 Simulator — iPhone 17 Pro Real device: iPhone 16 Pro Max Attachments: ContentView Link to the recording: https://drive.google.com/file/d/1HIwGXC39EVTbRVhJWBdFTJYCENuLxcc_/view?usp=drive_link For Reference: https://developer.apple.com/forums/thread/792662
Replies
0
Boosts
0
Views
65
Activity
Jun ’26
Push new views to sidebar when using NavigationPath
I have an existing app that uses NavigationSplitView with a detail view that is never changed and just updates to show changes in data. All navigation changes the sidebar only using NavigationLinks with .isDetailLink(false). Now I'm wanting to use NavigationPath with a simple router and enums. import SwiftUI @main struct NavRouterApp: App { @State private var router = Router() var body: some Scene { WindowGroup { NavigationStack(path: $router.navPath) { ContentView() .navigationDestination(for: AppRoute.self) { route in switch route { case .citizens: ContentView() .environment(router) case .citizen: EmptyView() .environment(router) case .tasform2: TASForm2View() .environment(router) case .start: StartView() .environment(router) case .editcharacteristics: EmptyView() .environment(router) case .basicdata(let citizen): BasicDataView(citizen: citizen) .environment(router) .navigationBarBackButtonHidden(true) case .characteristics: EmptyView() .environment(router) } } } .environment(router) } } } The prob
Topic: UI Frameworks SubTopic: SwiftUI
Replies
6
Boosts
0
Views
213
Activity
Jun ’26
Simulator screen recording shows iOS 26 navigation/sheet transition corner-rounding that is not visible on device
On iOS 26, a Simulator screen recording shows the bottom corners of content go from rounded to square during normal push and sheet transitions. This happens on the simulator, but I don't see this on a real iPhone. Steps to reproduce: Create a new SwiftUI app and use the attached content view. Run on an iOS 26 Simulator. Start a Simulator screen recording. Tap a row to push, and tap Filter to present the sheet. Stop the recording and play it back frame by frame. Run the same app on a real iPhone and watch the transitions live. Question: Is this a new feature or a simulator bug? Configuration: Xcode 26.4.1 iOS 26 Simulator — iPhone 17 Pro Real device: iPhone 16 Pro Max Attachments: ContentView
Replies
0
Boosts
0
Views
49
Activity
Jun ’26
Reply to WindowGrop How to customize bending styles?
This is still accurate. At the moment, there is no API to apply curvature to windows at the SwiftUI level.
Replies
Boosts
Views
Activity
Jun ’26
Delay when using ResultsObserver over @Query?
I was testing how to use ResultsObserver on a ViewModel in SwiftData. In Xcode 27, Developer v1, I have the following view import SwiftUI import SwiftData @Model class TaskItem { var name: String var priority: Int init(name: String, priority: Int) { self.name = name self.priority = priority } } @Observable @MainActor class RandomViewModel { let observer: ResultsObserver @ObservationIgnored private var token: ObservationTracking.Token? var tasks: FetchResultsCollection { observer.results } init(context: ModelContext) { let descriptor = FetchDescriptor( sortBy: [SortDescriptor(.name, order: .reverse)] ) observer = try! ResultsObserver(fetchDescriptor: descriptor, modelContext: context) } } struct RandomView: View { @State var viewModel: RandomViewModel? @Environment(.modelContext) private var modelContext var body: some View { VStack { if let viewModel { List(viewModel.tasks) { foo in Text(foo.name) } .toolbar { ToolbarItem(placement: .primaryAction) { Button(Add Task) { let task = TaskItem(name: ZZ Ne
Replies
1
Boosts
0
Views
915
Activity
Jun ’26
iOS 27 / SwiftUI — Search tab .prominent doesn't morph on activation (field goes to top, tabs don't collapse)
I'm building an app with Xcode 27. I had trouble getting the tab bar to detach the search button onto the trailing side. I found that the search behaviour now works through the new .prominent treatment on iOS 27 (with Tab(role: .search)), and the detached button now displays correctly. My remaining problem is the activation behaviour. Expected (as in the system Phone / News / App Store apps): tapping the search button morphs the tab bar — the other tabs collapse into a single leading button and the search field expands at the bottom, centered. Actual: tapping the search tab pushes the search field to the top of the screen, attached to the navigation bar, with no morph animation and no tab collapse. Setup: Xcode 27.0 beta, iOS 27.0 on a physical iPhone Air Same with the Simulator (by the way... i also have some terrible lag with my app on Simulator + my iPhone even with a release version, but not throught TestFlight... strange...) 3 standard tabs + 1 search tab Single .searchable(text:) applied directly on the
Topic: UI Frameworks SubTopic: SwiftUI
Replies
1
Boosts
0
Views
152
Activity
Jun ’26
EnvironmentBlendingComponent(.occluded(by: .surroundings)) culling entities entirely?
Hi there! While building my visionOS app, I’ve encountered some strange behaviour with EnvironmentBlendingComponent. Entities using .occluded(by: .surroundings) are culled entirely whenever a Mac Virtual Display or Apple Immersive Environment is behind them, regardless of the entities’ actual depth, and even when the environment is set to coexist. This feels like it could be a bug, although I’m fairly new to visionOS development, so I may be missing something! In a .mixed immersive space with plain passthrough, the component behaves as I would expect: an entity is occluded accurately when a real-world object is placed in front of it. However, when either of the following is visible behind the entity: a Mac Virtual Display window; or an Apple Immersive Environment enabled using the Digital Crown, the entity carrying EnvironmentBlendingComponent disappears completely. This happens even when the entity is physically closer to the viewer than the virtual surface. An otherwise identical entity without the componen
Replies
3
Boosts
0
Views
484
Activity
Jun ’26
AVSpeechSynthesizer executes utterances out of order
In previous releases of the os, AVSpeechSynthesizer executed utterances in the order that were enqueued - this is no longer the case. The following snippet should read the numbers 0 to 100 in order, instead it is read (as far as I can tell) randomly. I am unsure is this was an intentional change by Apple, if it was, this was not communicated effectively to developers. import SwiftUI import AVFoundation @main struct MyApp: App { var body: some Scene { WindowGroup { ContentView() } } } struct ContentView: View { let synthesiser = AVSpeechSynthesizer() var body: some View { Button(Synthesise) { for i in 0...100 { let utterance = AVSpeechUtterance(string: i.formatted()) synthesiser.speak(utterance) } } } } #Preview { ContentView() } FB23194665
Replies
1
Boosts
0
Views
487
Activity
Jun ’26
Reply to Request for VisionOS Image Presentation features
Sure thing, @RadicalEye. I'm glad you were able to properly scale the spatial image in your scene. As for your other questions, Feedback remains the most effective way to request enhancements in behavior. Once filed, please post the FB number here. In the interim, I'll note that the aforementioned ImagePresentationComponent sample uses both OrnamentAttachmentAnchor and position(relativeTo:) to position its content. As for layout in volumetric windows, Meet SwiftUI spatial layout (WWDC25) offers a helpful survey of current capabilities.
Replies
Boosts
Views
Activity
Jun ’26
Liquid Glass tab bar doesn't update its background on tab switch until I scroll — expected? Workaround?
Hi, On iOS 26 I'm seeing a behavior with the new Liquid Glass tab bar in SwiftUI and I can't tell if it's expected or if there's a supported workaround. When I switch tabs in a TabView, the floating Liquid Glass tab bar keeps the glass appearance it derived from the previous tab's content. It only refreshes to match the newly selected tab once I scroll the new tab's scroll view — even by a single point. In Apple's own apps (e.g. Home) the bar updates immediately on tab change, which makes me think this isn't intended. I reduced it to a minimal example — no images, no glassEffect, no NavigationStack, just gradients: struct ContentView: View { enum TabID: Hashable { case blue, green, dark } @State private var selection: TabID = .blue var body: some View { TabView(selection: $selection) { Tab(Blue, systemImage: drop.fill, value: .blue) { Page(colors: [.blue, .indigo]) } Tab(Green, systemImage: leaf.fill, value: .green) { Page(colors: [.green, .teal]) } Tab(Dark, systemImage: moon.fill, value: .dark) { P
Replies
0
Boosts
0
Views
371
Activity
Jun ’26
WeatherKit JWT permission error even though entitlement and provisioning profile appear correct
Hi Apple Developer Support / WeatherKit team, I’m seeing WeatherKit fail on a physical iPhone with what appears to be a JWT / permission issue, even though the app appears to be correctly configured and signed with the WeatherKit entitlement. App / project context: App name: Signals Platform: iOS Framework: SwiftUI WeatherKit usage: Native WeatherKit framework, using WeatherService.shared.weather(for:) Purpose: Showing a small morning weather summary inside the app What I have already verified: Active Apple Developer Program membership WeatherKit capability enabled for the App ID in Apple Developer Portal WeatherKit capability enabled in the App Capabilities tab WeatherKit capability added in Xcode Signing & Capabilities Automatic signing enabled Built and tested on a physical iPhone device Location permission is requested and granted The app binary appears to include the WeatherKit entitlement The embedded provisioning profile appears to include the WeatherKit entitlement Issue: WeatherKit still
Replies
3
Boosts
0
Views
254
Activity
Jun ’26
MapKit MapCamera
SwiftUI Map with MapCamera jerks on every GPS update instead of animating smoothly I'm trying to make camera to follow the user smoothly during navigation using MapCamera with heading and pitch, similar to Apple Maps or Google Maps. The camera updates on every GPS tick but instead of animating smoothly between positions it jerks , it snaps to the new position, pauses, snaps again, pauses...terrible UX. The blue user location (UserAnnotation) puck moves completely smoothly. Only the camera jerks I have tried all sort of animations and interpolation you may think of. Something is just not right, must be something missing from the puzzle. I have prepared a minimal reproducible example so you can copy and paste the only thing needed is to add the Privacy - Location When In Use Usage Description Run in Simulator, go to Features > Location > Freeway Drive and tap on Track then you'll notice how camera is following then stop then following and stops again Don't bother using AI, he has no clue what's t
Replies
0
Boosts
0
Views
129
Activity
Jun ’26