Search results for

“swiftui”

17,353 results found

Post

Replies

Boosts

Views

Activity

Reply to WidgetKit complications won't update
Data point from July 2026: this appears to work now - at least on current OS versions. Setup: iPhone companion (iOS 26.5) + SwiftUI-lifecycle watchOS app (watchOS 26.5) with WidgetKit accessory complications (no ClockKit) transferCurrentComplicationUserInfo() with a small dictionary payload (~6 keys), complication active on the watch face (isComplicationEnabled == true; the transfer budget was actually consumed: remainingComplicationUserInfoTransfers went 50 → 49 → 48 → 47) Both sides instrumented with file logging; every payload carries a monotonically increasing version, and we redundantly send the same update via updateApplicationContext as a fallback - so I can attribute exactly which channel applied each change Results - 3 consecutive sends while the watch was NOT reachable (isReachable == false on the phone at send time) and the watch app was backgrounded: sent 23:10:42.5 → didReceiveUserInfo on the watch at 23:10:57.6 (15.1 s). Ambiguous: the user happened to foreground the watch app ~150 ms b
5d
NavigationStack has no animations or back gesture in macOS
When running a native macOS app using SwiftUI and a NavigationStack, clicking any links causes the contents of the stack to change immediately with no animation, and you can't use the usual two-finger swipe gesture to go back. The behavior is correct when running it as a Mac Catalyst app, you get the animated transitions when navigating, and swiping works. Minimal Example: (put this directly inside the WindowGroup) NavigationStack { VStack { NavigationLink { Rectangle().foregroundStyle(.red) } label: { Text(Button) } } }
1
0
75
5d
Reply to iPadOS extended display architecture
This is very interesting post hope I understand correctly what you trying to accomplish, and more about when talking about MultipleScenes and moving Scenes to external displays. To build a native iPadOS application that utilizes an external display with custom layouts while preserving pointer interaction, you must adopt a Multi-Scene Architecture. But hope other developers also provide their solution here. https://developer.apple.com/documentation/swiftui/scene Treats the external display as an extended desktop. Fully preserves native pointer interaction, hover effects, and custom interactive layouts. You cannot force the window to open full-screen on the external display automatically; the OS or the user dictates window placement, though you can programmatically request a new scene. Because your app will effectively run two independent UI hierarchies (one on the iPad, one on the external display), your architecture must strictly separate UI from state. https://developer.apple.com/documentation/uikit
Topic: Design SubTopic: General Tags:
5d
Reply to SwiftUI Slider onEditingChanged is unreliable on iOS 26
Has anyone found a workaround or solution? I'm seeing this behavior in Xcode 26.6 (17F113) and MacOS 26.5.2., even with Apple's own example code. import SwiftUI struct SliderViewTest: View { @State private var speed = 50.0 @State private var isEditing = false var body: some View { VStack { Slider( value: $speed, in: 0...100, step: 5 ) { Text(Speed) } minimumValueLabel: { Text(0) } maximumValueLabel: { Text(100) } onEditingChanged: { editing in isEditing = editing } Text((speed)) .foregroundColor(isEditing ? .red : .blue) } } } #Preview { SliderViewTest() .padding() }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
6d
Reply to Learn Swift and SwiftUI in my old age?
[quote='836918021, pabugeater2, /thread/836918, /profile/pabugeater2'] find it pleasing/beneficial/productive to learn Swift/SwiftUI? [/quote] Let’s break that down: Pleasing That’s very much gonna depend on you. Beneficial Yes. Regardless of any other factors, there’s solid evidence that learning new stuff is beneficial, especially as you get older. Productive That kinda depends on what you intend to produce (-: As someone who’s not exactly young myself, I’ve started to understand that the time I have left is limited, and that I need to focus on what I enjoy. I absolutely love playing around with computers, so if and when I retire there’s no doubt I’ll continue doing that. Keep in mind that there’s a middle ground, namely using Swift to call the frameworks you already know. If you get pleasure from shipping stuff, that might be a good first step, rather than wrestling with Swift and SwiftUI at the same time. Share and Enjoy — Quinn “The Eskimo!” @ Developer Technical Support @ Apple let myE
6d
How can a SwiftUI drag provide the actual file URL of an existing file on macOS (as NSOutlineView does)?
I'm dragging existing files from a SwiftUI List (a search result list in a sandboxed, document-based Mac app), and I want drop targets to receive the actual file URL — the same behavior as AppKit's NSOutlineView with outlineView(_:pasteboardWriterForItem:) returning an NSURL: the Finder copies the file, browsers load it, and text views insert its path. My current implementation is Transferable-based: FileRepresentation(exportedContentType: .data) { item in SentTransferredFile(item.fileURL, allowAccessingOriginalFile: true) } .suggestedFileName(.fileURL.lastPathComponent) With this, what receivers get is a temporary copy in the app's own container (Caches/com.apple.SwiftUI.Drag-/), not the actual file URL — despite allowAccessingOriginalFile: true. Dropping on the Finder or onto an application icon works through the copy, but receivers that interpret the URL itself — a browser window, or a text view that inserts the dropped file's path — see the temporary container path. Note that the dragged files li
3
0
122
1w
Reply to Code Signing (I think)
Can you try running on the simulator instead of on a real device? If you are starting new: Learn swift (https://docs.swift.org/swift-book/documentation/the-swift-programming-language/) Learning iOS development (https://cs193p.stanford.edu) - Use this as a guidance, then once you are comfortable with the basics then refer to Apple documentation / WWDC videos Learn SwiftUI (WWDC videos are pretty good)
Topic: Code Signing SubTopic: General
1w
Reply to Learn Swift and SwiftUI in my old age?
Last year, at age 73, I decided to switch my hobby programming to Swift/SwiftUI from XOJO. I waited for SwiftUI to mature as UIKit made my eyes glaze over. After about 6 months of grinding, I successfully converted one of my XOJO apps. I now know there's a few things I did sub-optimally, so I'm continuing to learn. Jump in, the water's fine.
1w
Code Signing (I think)
Just started learning SWIFT. How come this code (in a separate file): // // indexLoader.swift // PhotoViewer // // Created by Bruce Quimby on 7/3/26. // import SwiftUI import SwiftData struct LoadIndex { let indexURL = https://Some URL; func getIndex() { print(The next step will be to get the index from this URL: + indexURL); } } makes my build fail with: Cannot create a iOS App Development provisioning profile for Just-Me.PhotoViewer.Retrieve-Index. Personal development teams, including ME, do not support the Accessory Setup Extension capability.
Topic: Code Signing SubTopic: General
2
0
137
1w
Learn Swift and SwiftUI in my old age?
Would an old guy (75) who is proficient in Obj-C, only codes for iOS/macOS/tvOS/web, and has spent the last 60 years promising himself “that’s definitely the last language I’m learning”, now find it pleasing/beneficial/productive to learn Swift/SwiftUI? Assume programming is relegated to a hobby and favorite pastime and I’ll live 10 more years :) Thanks.
2
0
218
1w
Is NavigationSplitView on macOS 27 broken?
On macOS 27 Beta 2, a simple NavigationSplitView example exhibits bizarre behaviour when the window is resized. The sidebar seemingly expands and collapses at random as the window is resized. The symptoms can be exacerbated with toolbar items. The sidebar appears to behave correctly when an inspector view is not present. Copy paste the code below into a new Xcode 27 project and run on macOS 27 and then resize the window: File -> New -> Project... -> App import SwiftUI @main struct MyApp: App { var body: some Scene { WindowGroup { ContentView() } } } struct ContentView: View { var body: some View { NavigationSplitView { Text(Sidebar) } detail: { Text(Content) } .inspector(isPresented: .constant(true)) { Text(Inspector) } } } Adding .frame or .inspectorColumnWidth to any of the Text views does not appear to fix the issues. macOS: 27.0 Beta (26A5368g) Xcode: 27.0 beta 2 (27A5209h)
Topic: UI Frameworks SubTopic: SwiftUI Tags:
2
0
142
1w
Reply to Pass data to an @Observable model
@ChrisDE Questions Should CarDetailViewModel be created in CarDetailView? Or should CarDetailViewModel be created in ContentView and passed to CarDetailView? Code ContentView struct ContentView: View { @State private var selectedCarID: UUID? var body: some View { NavigationSplitView { CarListView(selectedCarID: $selectedCarID) } detail: { if let selectedCarID { CarDetailView(carID: selectedCarID) } } } } CarListViewModel @Observable class CarListViewModel { let cars = [ Car(id: UUID(), name: aaa), Car(id: UUID(), name: bbb) ] } CarListView import SwiftUI struct CarListView: View { @Binding var selectedCarID: UUID? @State var model = CarListViewModel() var body: some View { List(model.cars, selection: $selectedCarID) { car in VStack(alignment: .leading) { Text(car.name) Text((car.id)) } } } } CarDetailViewModel @Observable class CarDetailViewModel { let carID: UUID init(carID: UUID) { self.carID = carID } } CarDetailView import SwiftUI struct CarDetailView: View { @State private var model: Ca
Topic: UI Frameworks SubTopic: SwiftUI Tags:
1w
Game Mode never engages for my card game
Environment: macOS 26.5, M4 Pro, native SwiftUI app (no MTKView/game render loop; it does use SwiftUI Metal shader effects). There's a related scheduling puzzle underneath: my app's worker threads are confined to E-cores for work that runs on P-cores from a CLI. The game computes AI decisions with brief CPU-bound bursts of parallel tree search. The identical library, doing node-count-identical work, runs ~6× slower inside the app than from a CLI on the same machine — the difference is core placement, not the workload. And since several bot decisions run in sequence each hand, that 6× stacks into user-visible seconds at the table: CLI process, default QoS: ~54ms per decision (P-cores) GUI app, worker threads at .userInitiated and .userInteractive: ~350ms (E-cores) Reproducible from the CLI with taskpolicy clamps: utility ≈ 92ms, background ≈ 584ms The app declares LSApplicationCategoryType = public.app-category.card-games and GCSupportsGameMode = true, and runs native full screen as the front
2
0
145
1w
toolbar` bottomBar disappears after rotating iPhone from portrait to landscape
I have a SwiftUI detail view with a native toolbar. On iPhone, the bottom toolbar appears correctly in portrait. After rotating the device to landscape, the bottom toolbar disappears. It does not come back unless the detail view is rebuilt. I would like to keep the native toolbar appearance and behavior, especially the iOS toolbar/glass effect. I do not want to replace it with a custom safeAreaInset bar. Environment Platform: iOS Current target/system: iOS 27 UI framework: SwiftUI Device idiom: iPhone The issue happens when rotating from portrait to landscape. Expected behavior The native bottom toolbar remains visible after device rotation. Actual behavior The native bottom toolbar is visible in portrait, but disappears after rotating to landscape. Core code The main view attaches toolbar content like this: private var contentWithToolbarAndSheets: some View { coreLayout .slateNavigationBarTitleDisplayModeInline() .toolbar { #if os(iOS) ToolbarItem(placement: .principal) { VStack(spacing: 0)
Topic: UI Frameworks SubTopic: SwiftUI
0
0
67
1w
Reply to WidgetKit complications won't update
Data point from July 2026: this appears to work now - at least on current OS versions. Setup: iPhone companion (iOS 26.5) + SwiftUI-lifecycle watchOS app (watchOS 26.5) with WidgetKit accessory complications (no ClockKit) transferCurrentComplicationUserInfo() with a small dictionary payload (~6 keys), complication active on the watch face (isComplicationEnabled == true; the transfer budget was actually consumed: remainingComplicationUserInfoTransfers went 50 → 49 → 48 → 47) Both sides instrumented with file logging; every payload carries a monotonically increasing version, and we redundantly send the same update via updateApplicationContext as a fallback - so I can attribute exactly which channel applied each change Results - 3 consecutive sends while the watch was NOT reachable (isReachable == false on the phone at send time) and the watch app was backgrounded: sent 23:10:42.5 → didReceiveUserInfo on the watch at 23:10:57.6 (15.1 s). Ambiguous: the user happened to foreground the watch app ~150 ms b
Replies
Boosts
Views
Activity
5d
NavigationStack has no animations or back gesture in macOS
When running a native macOS app using SwiftUI and a NavigationStack, clicking any links causes the contents of the stack to change immediately with no animation, and you can't use the usual two-finger swipe gesture to go back. The behavior is correct when running it as a Mac Catalyst app, you get the animated transitions when navigating, and swiping works. Minimal Example: (put this directly inside the WindowGroup) NavigationStack { VStack { NavigationLink { Rectangle().foregroundStyle(.red) } label: { Text(Button) } } }
Replies
1
Boosts
0
Views
75
Activity
5d
Reply to iPadOS extended display architecture
This is very interesting post hope I understand correctly what you trying to accomplish, and more about when talking about MultipleScenes and moving Scenes to external displays. To build a native iPadOS application that utilizes an external display with custom layouts while preserving pointer interaction, you must adopt a Multi-Scene Architecture. But hope other developers also provide their solution here. https://developer.apple.com/documentation/swiftui/scene Treats the external display as an extended desktop. Fully preserves native pointer interaction, hover effects, and custom interactive layouts. You cannot force the window to open full-screen on the external display automatically; the OS or the user dictates window placement, though you can programmatically request a new scene. Because your app will effectively run two independent UI hierarchies (one on the iPad, one on the external display), your architecture must strictly separate UI from state. https://developer.apple.com/documentation/uikit
Topic: Design SubTopic: General Tags:
Replies
Boosts
Views
Activity
5d
Reply to Is NavigationSplitView on macOS 27 broken?
Following up to say that this remains broken in macOS 27 beta 3. macOS 27.0 Beta (26A5378j) Xcode 27.0 beta 3 (27A5218g) Open Xcode, File -> New Project, macOS SwiftUI app and copy paste the code above and then run.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
5d
Reply to SwiftUI Slider onEditingChanged is unreliable on iOS 26
Has anyone found a workaround or solution? I'm seeing this behavior in Xcode 26.6 (17F113) and MacOS 26.5.2., even with Apple's own example code. import SwiftUI struct SliderViewTest: View { @State private var speed = 50.0 @State private var isEditing = false var body: some View { VStack { Slider( value: $speed, in: 0...100, step: 5 ) { Text(Speed) } minimumValueLabel: { Text(0) } maximumValueLabel: { Text(100) } onEditingChanged: { editing in isEditing = editing } Text((speed)) .foregroundColor(isEditing ? .red : .blue) } } } #Preview { SliderViewTest() .padding() }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
6d
Reply to Learn Swift and SwiftUI in my old age?
[quote='836918021, pabugeater2, /thread/836918, /profile/pabugeater2'] find it pleasing/beneficial/productive to learn Swift/SwiftUI? [/quote] Let’s break that down: Pleasing That’s very much gonna depend on you. Beneficial Yes. Regardless of any other factors, there’s solid evidence that learning new stuff is beneficial, especially as you get older. Productive That kinda depends on what you intend to produce (-: As someone who’s not exactly young myself, I’ve started to understand that the time I have left is limited, and that I need to focus on what I enjoy. I absolutely love playing around with computers, so if and when I retire there’s no doubt I’ll continue doing that. Keep in mind that there’s a middle ground, namely using Swift to call the frameworks you already know. If you get pleasure from shipping stuff, that might be a good first step, rather than wrestling with Swift and SwiftUI at the same time. Share and Enjoy — Quinn “The Eskimo!” @ Developer Technical Support @ Apple let myE
Replies
Boosts
Views
Activity
6d
How can a SwiftUI drag provide the actual file URL of an existing file on macOS (as NSOutlineView does)?
I'm dragging existing files from a SwiftUI List (a search result list in a sandboxed, document-based Mac app), and I want drop targets to receive the actual file URL — the same behavior as AppKit's NSOutlineView with outlineView(_:pasteboardWriterForItem:) returning an NSURL: the Finder copies the file, browsers load it, and text views insert its path. My current implementation is Transferable-based: FileRepresentation(exportedContentType: .data) { item in SentTransferredFile(item.fileURL, allowAccessingOriginalFile: true) } .suggestedFileName(.fileURL.lastPathComponent) With this, what receivers get is a temporary copy in the app's own container (Caches/com.apple.SwiftUI.Drag-/), not the actual file URL — despite allowAccessingOriginalFile: true. Dropping on the Finder or onto an application icon works through the copy, but receivers that interpret the URL itself — a browser window, or a text view that inserts the dropped file's path — see the temporary container path. Note that the dragged files li
Replies
3
Boosts
0
Views
122
Activity
1w
Reply to Code Signing (I think)
Can you try running on the simulator instead of on a real device? If you are starting new: Learn swift (https://docs.swift.org/swift-book/documentation/the-swift-programming-language/) Learning iOS development (https://cs193p.stanford.edu) - Use this as a guidance, then once you are comfortable with the basics then refer to Apple documentation / WWDC videos Learn SwiftUI (WWDC videos are pretty good)
Topic: Code Signing SubTopic: General
Replies
Boosts
Views
Activity
1w
Reply to Learn Swift and SwiftUI in my old age?
Last year, at age 73, I decided to switch my hobby programming to Swift/SwiftUI from XOJO. I waited for SwiftUI to mature as UIKit made my eyes glaze over. After about 6 months of grinding, I successfully converted one of my XOJO apps. I now know there's a few things I did sub-optimally, so I'm continuing to learn. Jump in, the water's fine.
Replies
Boosts
Views
Activity
1w
Code Signing (I think)
Just started learning SWIFT. How come this code (in a separate file): // // indexLoader.swift // PhotoViewer // // Created by Bruce Quimby on 7/3/26. // import SwiftUI import SwiftData struct LoadIndex { let indexURL = https://Some URL; func getIndex() { print(The next step will be to get the index from this URL: + indexURL); } } makes my build fail with: Cannot create a iOS App Development provisioning profile for Just-Me.PhotoViewer.Retrieve-Index. Personal development teams, including ME, do not support the Accessory Setup Extension capability.
Topic: Code Signing SubTopic: General
Replies
2
Boosts
0
Views
137
Activity
1w
Learn Swift and SwiftUI in my old age?
Would an old guy (75) who is proficient in Obj-C, only codes for iOS/macOS/tvOS/web, and has spent the last 60 years promising himself “that’s definitely the last language I’m learning”, now find it pleasing/beneficial/productive to learn Swift/SwiftUI? Assume programming is relegated to a hobby and favorite pastime and I’ll live 10 more years :) Thanks.
Replies
2
Boosts
0
Views
218
Activity
1w
Is NavigationSplitView on macOS 27 broken?
On macOS 27 Beta 2, a simple NavigationSplitView example exhibits bizarre behaviour when the window is resized. The sidebar seemingly expands and collapses at random as the window is resized. The symptoms can be exacerbated with toolbar items. The sidebar appears to behave correctly when an inspector view is not present. Copy paste the code below into a new Xcode 27 project and run on macOS 27 and then resize the window: File -> New -> Project... -> App import SwiftUI @main struct MyApp: App { var body: some Scene { WindowGroup { ContentView() } } } struct ContentView: View { var body: some View { NavigationSplitView { Text(Sidebar) } detail: { Text(Content) } .inspector(isPresented: .constant(true)) { Text(Inspector) } } } Adding .frame or .inspectorColumnWidth to any of the Text views does not appear to fix the issues. macOS: 27.0 Beta (26A5368g) Xcode: 27.0 beta 2 (27A5209h)
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
2
Boosts
0
Views
142
Activity
1w
Reply to Pass data to an @Observable model
@ChrisDE Questions Should CarDetailViewModel be created in CarDetailView? Or should CarDetailViewModel be created in ContentView and passed to CarDetailView? Code ContentView struct ContentView: View { @State private var selectedCarID: UUID? var body: some View { NavigationSplitView { CarListView(selectedCarID: $selectedCarID) } detail: { if let selectedCarID { CarDetailView(carID: selectedCarID) } } } } CarListViewModel @Observable class CarListViewModel { let cars = [ Car(id: UUID(), name: aaa), Car(id: UUID(), name: bbb) ] } CarListView import SwiftUI struct CarListView: View { @Binding var selectedCarID: UUID? @State var model = CarListViewModel() var body: some View { List(model.cars, selection: $selectedCarID) { car in VStack(alignment: .leading) { Text(car.name) Text((car.id)) } } } } CarDetailViewModel @Observable class CarDetailViewModel { let carID: UUID init(carID: UUID) { self.carID = carID } } CarDetailView import SwiftUI struct CarDetailView: View { @State private var model: Ca
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
1w
Game Mode never engages for my card game
Environment: macOS 26.5, M4 Pro, native SwiftUI app (no MTKView/game render loop; it does use SwiftUI Metal shader effects). There's a related scheduling puzzle underneath: my app's worker threads are confined to E-cores for work that runs on P-cores from a CLI. The game computes AI decisions with brief CPU-bound bursts of parallel tree search. The identical library, doing node-count-identical work, runs ~6× slower inside the app than from a CLI on the same machine — the difference is core placement, not the workload. And since several bot decisions run in sequence each hand, that 6× stacks into user-visible seconds at the table: CLI process, default QoS: ~54ms per decision (P-cores) GUI app, worker threads at .userInitiated and .userInteractive: ~350ms (E-cores) Reproducible from the CLI with taskpolicy clamps: utility ≈ 92ms, background ≈ 584ms The app declares LSApplicationCategoryType = public.app-category.card-games and GCSupportsGameMode = true, and runs native full screen as the front
Replies
2
Boosts
0
Views
145
Activity
1w
toolbar` bottomBar disappears after rotating iPhone from portrait to landscape
I have a SwiftUI detail view with a native toolbar. On iPhone, the bottom toolbar appears correctly in portrait. After rotating the device to landscape, the bottom toolbar disappears. It does not come back unless the detail view is rebuilt. I would like to keep the native toolbar appearance and behavior, especially the iOS toolbar/glass effect. I do not want to replace it with a custom safeAreaInset bar. Environment Platform: iOS Current target/system: iOS 27 UI framework: SwiftUI Device idiom: iPhone The issue happens when rotating from portrait to landscape. Expected behavior The native bottom toolbar remains visible after device rotation. Actual behavior The native bottom toolbar is visible in portrait, but disappears after rotating to landscape. Core code The main view attaches toolbar content like this: private var contentWithToolbarAndSheets: some View { coreLayout .slateNavigationBarTitleDisplayModeInline() .toolbar { #if os(iOS) ToolbarItem(placement: .principal) { VStack(spacing: 0)
Topic: UI Frameworks SubTopic: SwiftUI
Replies
0
Boosts
0
Views
67
Activity
1w