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

Posts under SwiftUI tag

200 Posts
Sort by:

Post

Replies

Boosts

Views

Activity

Transition Move to Bottom doesn't respect animation duration
Hi all, I’m working on a custom action sheet in SwiftUI that slides in and out from the bottom using .transition(.move(edge: .bottom)). However, I’ve encountered an issue where the transition doesn’t respect my specified animation duration. Here’s the basic structure of my action sheet: ZStack { Color.black .opacity(0.5) VStack { SomeActionSheetContent() } .transition(.move(edge: .bottom)) .zIndex(1) } Each button inside the action sheet triggers a dismissal using this code: Button { withAnimation(onDismissAnimation) { isPresented = false } } onDismissAnimation can be any Animation, but for demonstration, I’m using .linear(duration: 5). The problem is that when dismissing the action sheet, the animation is significantly faster than expected, around 5 times faster. For example, a 0.35-second animation finishes in just a fraction of that time. To investigate further, I tested with .transition(.move(edge: .top)), and in that case, the transition respects the specified animation duration perfectly. Does anyone know why the transition behaves differently when dismissing to the bottom versus the top?
1
0
54
8h
Toolbar buttons in HStack merge with menu when .buttonStyle(…) is set
I do not understand what is happening here. In this example, the toolbar has three Button and one Menu inside an HStack, where the every button has a .buttonStyle(_:) set. ToolbarItem(placement: .bottomBar) { HStack { Button {} label: { Label("Foo", systemImage: "square") } .buttonStyle(.bordered) Button {} label: { Label("Bar", systemImage: "circle") } .buttonStyle(.borderless) Menu { Button {} label: { Label("One", systemImage: "figure.arms.open") } Button {} label: { Label("Two", systemImage: "figure.2.arms.open") } } label: { Label("Baz", systemImage: "star") } Button {} label: { Label("Quux", systemImage: "triangle") } .buttonStyle(.borderedProminent) } } Please note: the menu has a star icon. This causes only the menu button to appear, but with the first button's icon: If a single button have has its styles removed, the toolbar appears as expected (in this example all button styles are removed): This example uses the bottom bar, but also happens when using placement: .navigation, placement: .topBarLeading, placement: .topBarTrailing.
2
0
65
17h
Remove intermediate screen from NavigationStack path
When remove intermediate screen from path I expect the same behaviour like removing view controller from UINavigationController.viewControllers in UIKit. But now it evoke pop animation and recreate associated StateObject. It looks like instead of remove specific view controller in hierarchy, it removes the last one and change content on previous. Code example to reproduce (Open Screen1, then Screen2 and touch Pop previous button): enum Screen: String { case screen1 case screen2 } struct ContentView: View { @State var path: [Screen] = [] var body: some View { NavigationStack(path: $path) { VStack { Text("Root") Button("open Screen 1") { path.append(.screen1) } } .navigationDestination(for: Screen.self) { switch $0 { case .screen1: ScreenView1(path: $path) case .screen2: ScreenView2(path: $path) } } } } } struct ScreenView1: View { @Binding var path: [Screen] var body: some View { VStack { Text("Screen 1") Button("Pop") { path.removeLast() } Button("open Screen 2") { path.append(.screen2) } } } } struct ScreenView2: View { @Binding var path: [Screen] @StateObject var viewModel: Screen2ViewModel = .init() var body: some View { VStack { Text("Screen 2") Button("Pop") { path.removeLast() } Button("Pop previous") { // !!! Here the problem path.remove(at: path.count - 2) } .disabled(path.count < 2) } } } class Screen2ViewModel: ObservableObject { init() { print("Screen2ViewModel.init") } } Screencast: It is possible to avoid pop animation by modifying path in transaction without animation: var transaction = Transaction() transaction.disablesAnimations = true withTransaction(transaction) { path.remove(at: path.count - 2) } But my question is: it is possible to avoid screen associated StateObject recreating?
0
0
18
16h
OnReceive from RCP not functioning
A timeline in RCP will post a notification "Identifier: Completed" when it finishes playing I am trying to receive this in the following way: extension Notification.Name { static let notifyOnAnimationCompleted = Notification.Name("Completed") } // in the view private let AnimationCompleted = NotificationCenter.default.publisher(for: .notifyOnAnimationCompleted) RealityView {...} .onReceive(AnimationCompleted) { _ in print("End") } This was once working back to July, but it never prints "End" for now
1
0
65
8h
How to wrangle Sendable ReferenceFileDocument and SwiftUI
I recently circled back to a SwiftUI Document-based app to check on warnings, etc. with Xcode 16 and Swift 6 now released. I just found a suite a new errors that indicate that ReferenceFileDocument is now expected to be Sendable, which seems very off for it fundamentally being a reference type. I followed the general pattern from earlier sample code: Building Great Apps with SwiftUI, which goes from an Observable object to adding conformance to ReferenceFileDocument in an extension. But then the various stored properties on the class cause all manner of complaint - given that they're not, in fact, sendable. What is an expected pattern that leverages a final class for the ReferenceDocument, but maintains that Sendability? Or is there a way to "opt out" of Sendability for this protocol? I'm at a bit of a loss on the expectation that ReferenceFileDocument is sendable at all, but since it's marked as such, I'm guessing there's some path - I'm just not (yet) clear on how to accomodate that.
1
0
74
1d
Send messages to the scene
I saw onnoffitacation in the Behavior configuration of Reality Composer pro, which asked me to enter the Nofficatition name, that is to say, this requires swift in Xcode to send a message. There is a message name in the message, so I hope you can write a list for me how to use Swift in Xcode to send a message containing the message name.(There is an answer in https://developer.apple.com/forums/thread/756978, but it doesn't work.) and in the time line in Reality Composer Pro, there is a Notification action, which is used to send messages to swift. How can I ask swift to detect whether the Notification action has sent a message?(There is an answer in https://developer.apple.com/videos/play/wwdc2024/10102/, but it doesn't work.) I have asked this question before (https://developer.apple.com/forums/thread/756978). Those answers were available before, but now they are all invalid in the latest system. I hope you can help me. Thank you.
1
0
125
1d
App Not Appearing in "Available Apps" List in Watch App
I’ve developed an Apple Watch extension for an existing iOS app. When I run the app on the watch via Xcode using the simulator, everything works fine. However, when I try to install it on my iPhone, the Watch app doesn’t show it in the "Available Apps" list, so I can't install it on the watch. The Apple Watch is connected to my iPhone, and I can see other apps available for installation without any issues. I also created a brand new project with watchOS support to troubleshoot, but the same problem occurred. Any ideas on how to resolve this?
0
0
54
1d
Grouping Apps impossible when Apps are not lined up.
I have been playing around with the page layout on my IPad Pro and discovered that is is impossible to group apps if you leave an empty space in the page. I found the option fun to finally place my apps where i want and not just lined up from top to bottom. I discovered if you leave gaps in the page layout it is impossible to groupe apps. The moment you hover the app over the groupe, the groupe shifts back to fill the empty space. Once I filled up all the empty space then the groupe stops moving. It is pretty annoying. The was excited to see the new feature to finally hate it completely. I do hope someone will fix this problem.
1
0
43
1d
Button icon in List to match style?
I am trying to figure out how to set a button's label icon to match the button style when inside a list. These four buttons display differently depending on context – if put inside a List or a VStack: Button(role: .destructive) {} label: { Label("Test", systemImage: "figure") }.buttonStyle(.automatic) Button(role: .destructive) {} label: { Label("Test", systemImage: "figure") }.buttonStyle(.bordered) Button {} label: { Label("Test", systemImage: "figure") }.buttonStyle(.borderedProminent) Button(role: .destructive) {} label: { Label("Test", systemImage: "figure") }.buttonStyle(.borderedProminent) Inside a List, which looks weird in my opinion. For reference, this is what they look like inside a VStack, which is what I'd expect: I am not sure if this is intentional or a bug. If there are any workaround which do not explicitly set a specific color, like .foreground(.red), please let me know.
2
0
79
21h
SwiftUI LongPressGesture does not work as expected in Xcode Version 16.0 (16A242) and iOS 18
When I copy and paste example code in apple developer documentation, LongPressGesture does not work as expected in Xcode Version 16.0 (16A242) and iOS 18. It seems updating(_:body:) method does not work when used with LongPressGesture. When I make a breakpoint in updating(_:body:) method and long press the blue circle on the screen of simulator(or device), it is expected to be caught in breakpoint or it is expected that color of circle turns from blue to red to green. However, it is not caught in breakpoint and never turns to red. Question of Stackoverflow is about same issue and I can not use onLongPressGesture method to implement required feature of my app. I submitted bug report via Feedback Assistant and my report's ID is FB15127375 and FB15173175. Please tell me if there is any investigation about this issue. Development environment: Xcode Version 16.0 (16A242), macOS 14.5 Run-time configuration: iOS 18.0
1
0
53
1d
Cannot convert value of type '[Lesson]' to expected argument type 'Binding<C>' and Generic parameter 'C' could not be inferred
I have a problem with ForEach loop, and when i debug the program there appear a problems: Cannot convert value of type '[Lesson]' to expected argument type 'Binding' Generic parameter 'C' could not be inferred Please help me import SwiftUI import Foundation struct ContentView: View { var lessons: [Lesson] = [] let todaysDate = Date() let lessonTime = Date()...Date().addingTimeInterval(45*60) let startProgress = Date().addingTimeInterval(-60) let endProgress = Date().addingTimeInterval(60) @State private var currentLesson: String = "Przerwa" var body: some View { let liveHourString = todaysDate.formatted(date: .omitted, time: .shortened) let liveHourString = "9:10" let liveWeekdayString = todaysDate.formatted(Date.FormatStyle().weekday(.wide)) ForEach(lessons) { lesson in if lesson.startTime <= liveHourString && lesson.endTime >= liveHourString && lesson.dayOfWeek == liveWeekdayString { currentLesson = lesson.name currentLessonStart = lesson.startTime } } VStack { ProgressView(timerInterval: startProgress...endProgress, countsDown: false) { Text(currentLesson) } currentValueLabel: { Text(currentLessonStart...endProgress) } .padding([.top, .leading, .trailing], 15.0) NavigationView{ List(lessons) { lesson in if lesson.dayOfWeek == todaysDate.formatted(Date.FormatStyle().weekday(.wide)) { VStack(alignment: .leading){ Text(lesson.name) Text("\(lesson.startTime) - \(lesson.endTime)") .foregroundStyle(.secondary) Text(lesson.room) .foregroundStyle(.secondary) } } } .navigationBarTitle(Text("Today's Lessons")) } } } } #Preview { ContentView(lessons: testData) } And i have also this file: struct Lesson: Identifiable { var id = UUID() var name: String var room: String var startTime: String var endTime: String var dayOfWeek: String } #if DEBUG let testData = [ //MONDAY Lesson(name: "Programowanie Aplikacji Webowych", room: "J3", startTime: "8:00", endTime: "8:45", dayOfWeek: "Monday"), Lesson(name: "Programowanie Aplikacji Webowych", room: "J3", startTime: "8:50", endTime: "9:35", dayOfWeek: "Monday"), Lesson(name: "Programowanie Aplikacji Webowych", room: "J3", startTime: "9:40", endTime: "10:25", dayOfWeek: "Monday"), Lesson(name: "Język Angielski", room: "Y2", startTime: "10:45", endTime: "11:30", dayOfWeek: "Monday"), Lesson(name: "Język Niemiecki", room: "Y4", startTime: "11:40", endTime: "12:25", dayOfWeek: "Monday"), Lesson(name: "Język Angielski", room: "Y2", startTime: "12:35", endTime: "13:20", dayOfWeek: "Monday"), Lesson(name: "Matematyka", room: "B10", startTime: "13:25", endTime: "14:10", dayOfWeek: "Monday"), //TUESDAY Lesson(name: "WF", room: "Sala Gimnastyczna", startTime: "8:50", endTime: "9:35", dayOfWeek: "Tuesday"), Lesson(name: "WF", room: "Sala Gimnastyczna", startTime: "9:40", endTime: "10:25", dayOfWeek: "Tuesday"), Lesson(name: "Programowanie Aplikacji Desktopowych", room: "X7", startTime: "10:45", endTime: "11:30", dayOfWeek: "Tuesday"), Lesson(name: "Programowanie Aplikacji Desktopowych", room: "X7", startTime: "11:40", endTime: "12:25", dayOfWeek: "Tuesday"), Lesson(name: "Testowanie i Dokumentowanie Aplikacji", room: "J5", startTime: "12:35", endTime: "13:20", dayOfWeek: "Tuesday"), Lesson(name: "Testowanie i Dokumentowanie Aplikacji", room: "J5", startTime: "13:25", endTime: "14:10", dayOfWeek: "Tuesday"), Lesson(name: "Projektowanie Oprogramowania", room: "J5", startTime: "14:15", endTime: "15:00", dayOfWeek: "Tuesday"), Lesson(name: "Projektowanie Oprogramowania", room: "J5", startTime: "15:05", endTime: "15:50", dayOfWeek: "Tuesday"), //WEDNESDAY Lesson(name: "Programowanie Aplikacji Mobilnych", room: "X1", startTime: "8:00", endTime: "8:45", dayOfWeek: "Wednesday"), Lesson(name: "Programowanie Aplikacji Mobilnych", room: "X1", startTime: "8:50", endTime: "9:35", dayOfWeek: "Wednesday"), Lesson(name: "Matematyka", room: "B10", startTime: "9:40", endTime: "10:25", dayOfWeek: "Wednesday"), Lesson(name: "Matematyka", room: "B10", startTime: "10:45", endTime: "11:30", dayOfWeek: "Wednesday"), Lesson(name: "Język Polski", room: "A7", startTime: "11:40", endTime: "12:25", dayOfWeek: "Wednesday"), Lesson(name: "Język Polski", room: "A7", startTime: "12:35", endTime: "13:20", dayOfWeek: "Wednesday"), Lesson(name: "Historia", room: "L5", startTime: "13:25", endTime: "14:10", dayOfWeek: "Wednesday"), //THURSDAY Lesson(name: "Chemia", room: "C7", startTime: "8:00", endTime: "8:45", dayOfWeek: "Thursday"), Lesson(name: "WoS", room: "C8", startTime: "8:50", endTime: "9:35", dayOfWeek: "Thursday"), Lesson(name: "Matematyka", room: "B10", startTime: "9:40", endTime: "10:25", dayOfWeek: "Thursday"), Lesson(name: "Programowanie Obiektowe", room: "X1", startTime: "10:45", endTime: "11:30", dayOfWeek: "Thursday"), Lesson(name: "Programowanie Obiektowe", room: "X1", startTime: "11:40", endTime: "12:25", dayOfWeek: "Thursday"), Lesson(name: "Język Polski", room: "A7", startTime: "12:35", endTime: "13:20", dayOfWeek: "Thursday"), //FRIDAY Lesson(name: "Język Angielski", room: "Y2", startTime: "8:00", endTime: "8:45", dayOfWeek: "Friday"), Lesson(name: "Chemia", room: "C7", startTime: "8:50", endTime: "9:35", dayOfWeek: "Friday"), Lesson(name: "Geografia", room: "C10", startTime: "9:40", endTime: "10:25", dayOfWeek: "Friday"), Lesson(name: "Matematyka", room: "B10", startTime: "10:45", endTime: "11:30", dayOfWeek: "Friday"), Lesson(name: "Godzina Wychowawcza", room: "C15", startTime: "11:40", endTime: "12:25", dayOfWeek: "Friday"), Lesson(name: "WF", room: "Sala Gimnastyczna", startTime: "12:35", endTime: "13:20", dayOfWeek: "Friday"), Lesson(name: "Biologia", room: "C7", startTime: "13:25", endTime: "14:10", dayOfWeek: "Friday"), ] #endif
3
0
129
1d
Swift pressesBegan no longer works iOS 18?
Previously this code would trigger fine on pressesBegan in iOS 17 and earlier versions, but no longer works in iOS 18. How can I start capturing pressesBegan in iOS 18? It seems like UIResponder is just not capturing the keyboard anymore? struct ContentView: View { var body: some View { KeyBoardView() } } //To Use in SwiftUI struct KeyBoardView: UIViewRepresentable{ func makeUIView(context: Context) -> KeyEventView { KeyEventView() } func updateUIView(_ uiView: KeyEventView, context: Context) { } class KeyEventView: UIView { init() { super.init(frame: CGRect(x: 0, y: 0, width: 0, height: 0)) } required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } override func pressesBegan(_ presses: Set<UIPress>, with event: UIPressesEvent?) { print("test") } } }
0
0
59
2d
Xcode 16 - List Lazy loading broken
In Xcode 16 and Xcode 16.1 beta 2 the lazy loading of list does not work properly. Tested on physical device with iOS 17. Below is minimal code to reproduce this issue: You can see in the debug console how many child views are initialized based on the print statement. import SwiftUI @main struct TestDemoApp: App { let data = Array(1...1000) var body: some Scene { WindowGroup { List(data, id: \.self) { item in SomeView(item: item) } } } } struct SomeView: View { static var count = 0 let item: Int init(item: Int){ self.item = item Self.count += 1 print(Self.count) } var body: some View{ Text(String(item)) .frame(height: 100) } } When the view is shown the List creates all child views at once as shown in the console output: It does not loads only first 13 out of 1000 as it does in older xcode 15.2: As the List is quite often used component in Swiftui Apps, the apps will be slow, because all the data are loaded and the main thread will be stuck until all child views are loaded.
1
0
88
1d
Unable to use transitions for SwiftData in List
I can't for the life of me get transitions and animations to work well with SwiftData and List on MacOS 15 and iOS 18. I've included an example below, where I define several animations and a transition type, but they are all ignored. How do I animate items being added to / removed from a List()? I am attached to List() due to its support for selection, context menu, keyboard shortcuts, etc. If I would switch to ScrollView with VStack I would have to rebuild all of that. Also, this is super basic and should just work, right? Thanks for reading. import SwiftUI import SwiftData struct ContentView: View { @Environment(\.modelContext) private var modelContext /// Issues on iOS: /// Items animate into and out of view, but I seem to have no control over the animation. /// In the code here I've specified a 'bouncy' and a slow 'easeIn' animation: both are not triggered. /// The code also specifies using a 'slide' transition, but it is ignored. /// -> How do I control the transition and animation timing on iOS? /// /// Issues on MacOS: /// Items do not animate at all on MacOS! They instantly appear and are instantly removed. /// -> How do I control the transition and animation timing on MacOS? // animation added here -> has no effect? @Query(animation: .bouncy) private var items: [Item] var body: some View { VStack { Button("Add to list") { // called without 'withAnimation' -> no animation let newItem = Item(timestamp: Date()) modelContext.insert(newItem) } List() { ForEach(items, id: \.self) { item in Text(item.timestamp, format: Date.FormatStyle(date: .numeric, time: .standard)) .transition(.slide) // items do not slide in/out of view .onTapGesture { // called with 'withAnimation' -> no animation withAnimation(.easeIn(duration: 2)) { modelContext.delete(item) } } } .animation(.spring(duration: 3), value: items) } } .padding() } } #Preview { ContentView() .modelContainer(for: Item.self, inMemory: true) }
1
0
52
2d
SwiftUI TextField inside Toolbar on MacOS not trigger onChange of focusedState
struct ContentView: View { @State private var editTitle = "title" @FocusState private var isFocused: Bool var body: some View { NavigationSplitView { Text("sidebar") } detail: { Text("detail") .navigationTitle("") .toolbar { ToolbarItem(placement: .principal) { TextField("", text: $editTitle) .focused($isFocused) .onChange(of: isFocused) { oldValue, newValue in print("onChange") } } } } } } on iOS, onChange is triggerred when TextField is inside toolbar or not on MacOS, onChange is not triggerred when TextField is inside toolbar, but when not in toolbar, it works fine
0
0
74
3d
Bug and crash when changing tabs in SwiftUI on the mac.
I like how the TabView control looks on the mac and ipad and decided to see if my current code can show the tabs in my multi-platform app just to realize that whenever I click on one of those tabs my macOS app currently crashes every time I press any other tab with the error: Thread 1: "NSToolbar 0x600003de33c0 already contains an item with the identifier com.apple.SwiftUI.navigationSplitView.toggleSidebar. Duplicate items of this type are not allowed." While trying to troubleshoot I noticed several other people have had a similar issue with differing reasons (toolbars and searchers mentioned) all in macOS since upgrading to 15.0: https://forums.developer.apple.com/forums/thread/763829 Minimal Viable Project: to show the issue I commented out most of my code calls hoping to create a project that worked so I could bring my code back in and see if it broke. I still had this issue so I next created a minimal viable example. Here it is: import SwiftUI import SwiftData @Model class Issue { var name: String init(name: String) { self.name = name } } @main struct TestMultiplatformApp: App { var sharedModelContainer: ModelContainer = { let schema = Schema([ Issue.self, ]) let modelConfiguration = ModelConfiguration(schema: schema, isStoredInMemoryOnly: false) do { return try ModelContainer(for: schema, configurations: [modelConfiguration]) } catch { fatalError("Could not create ModelContainer: \(error)") } }() var body: some Scene { WindowGroup { ContentView() } .modelContainer(sharedModelContainer) } } struct ContentView: View { @State var isCompact: Bool = true var body: some View { VStack { if isCompact { EntryTab() } else { EntrySidebar() } Toggle(isOn: $isCompact, label: { Text(isCompact ? "TabView" : "Sidebar") }) .padding(.horizontal, 20) .padding(.bottom, 20) } } } public struct tabControl: Identifiable, Hashable, Sendable { public static func == (lhs: tabControl, rhs: tabControl) -> Bool { lhs.id < rhs.id } public var id: Int // Tab Number public var displayName: String public init(id: Int, displayName: String) { self.id = id self.displayName = displayName } } struct EntryTab: View { let entryTabs = [ tabControl(id: 0, displayName: "row 0"), tabControl(id: 1, displayName: "row 1"), tabControl(id: 2, displayName: "row 2"), tabControl(id: 3, displayName: "row 3") ] @State private var selectedTab: Int = 0 var body: some View { TabView(selection: $selectedTab) { ForEach(entryTabs) { tabCtrl in NavigationSplitView { Text("Selected tab is \(selectedTab)") } detail: { Text("Choose item from sidebar... in future this would be content") } .tabItem { Text(tabCtrl.displayName) } .tag(tabCtrl.id) } } } } struct EntrySidebar: View { @State private var selectedTabID: Int? let entryTabs = [ tabControl(id: 0, displayName: "row 0"), tabControl(id: 1, displayName: "row 1"), tabControl(id: 2, displayName: "row 2"), tabControl(id: 3, displayName: "row 3") ] var body: some View { NavigationSplitView(sidebar: { List(entryTabs, id:\.id, selection: $selectedTabID) { thisItem in Text(thisItem.displayName) } }, content: { Text("Hi selected tab: \(String(describing: selectedTabID))") }, detail: { Text("Choose item from sidebar... in future this would be content") }) .onAppear() { // Set the selected tab selectedTabID = 1 } } }
0
0
100
3d
My Swift concurrency is no longer running properly and it's screwing up my SwiftData objects
I have a bug I've come across since I've upgraded Xcode (16.0) and macOS (15.0 Sequoia) and figured I'd create a minimal viable example in case someone else came across this and help. I've noticed this in both the macOS and iOS version of my app when I run it. Essentially I have an area of my code that calls a class that has a step 1 and 2 process. The first step uses async let _ = await methodCall(...) to create some SwiftData items while the second step uses a TaskGroup to go through the created elements, checks if an image is needed, and syncs it. Before this worked great as the first part finished and saved before the second part happened. Now it doesn't see the save and thus doesn't see the insertions/edits/etc in the first part so the second part just isn't done properly. Those step one changes are set and shown in the UI so, in this case, if I run it again the second part works just fine on those previous items while any newly created items are skipped. I came across this issue when step one handled 74 inserts as each one didn't contain an image attached to it. When I switched the async let _ = await methodCall(...) to a TaskGroup, hoping that would wait better and work properly, I had the same issue but now only 10 to 30 items were created from the first step. Minimal Viable Example: to reproduce something similar In my minimal viable sample I simplified it way down so you can't run it twice and it's limited it creating 15 subitems. That said, I've hooked it up with both an async let _ = await methodCall(...) dubbed AL and a TaskGroup dubbed TG. With both types my second process (incrementing the number associated with the subissue/subitem) isn't run as it doesn't see the subitem as having been created and, when run with TaskGroup, only 12 to 15 items are created rather that the always 15 of async let. Code shared here: https://gist.github.com/SimplyKyra/aeee2d43689d907d7a66805ce4bbf072 And this gives a macOS view of showing each time the button is pressed the sub issues created never increment to 1 while, when using TaskGroup, 15 isn't guaranteed to be created and remembered. I'm essentially wondering if anyone else has this issue and if so have you figured out how to solve it? Thanks
0
0
95
3d
Possible NavigationSplitView bug
With macOS 15, I'm noticing a new behavior when initializing a NavigationSplitView with columnVisibility. For example: @State var sidebar = NavigationSplitViewVisibility.all var body: some View { ZStack { NavigationSplitView(columnVisibility: $sidebar) { This code previous to macOS 15 would behave as expected: the sidebar could be toggled and the views would stay intact. However, when you update sidebar after updating to macOS 15, the entire view is reinitialized, meaning that every single child view that depends on this parent view is also reinitialized. Is this expected behavior? Simply clicking the toggle sidebar UI button does not reinitialize views, but when you initialize a NavigationSplitView with the column visibility, changes to the sidebar will completely reload the UI. Has anyone else experienced this?
0
0
86
3d
Positioning share sheet on VisionOS
I am trying to position the share sheet popped up by the shareLink API on VisionOS, but the share sheet is always anchored by at the label position. I checked the Photos app is achieving this already, the share sheet there appears at very center of the window while the share button locates at the corner inside the menu. How is this possible to make it?
1
0
97
3d