diff --git a/ExampleProject/ExampleProject.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/ExampleProject/ExampleProject.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index 3fc8490..32061df 100644 --- a/ExampleProject/ExampleProject.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/ExampleProject/ExampleProject.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -16,7 +16,7 @@ "location" : "https://github.com/sentryco/SplitViewKit", "state" : { "branch" : "main", - "revision" : "6af591d8e37e5d3a50ece47284f575ef92da42e8" + "revision" : "aba1f7662313432f377c8b75621b114a8622abdb" } } ], diff --git a/Sources/SplitViewKit/SplitViewContainer+Content.swift b/Sources/SplitViewKit/SplitViewContainer+Content.swift index d93bb09..05dbc2b 100644 --- a/Sources/SplitViewKit/SplitViewContainer+Content.swift +++ b/Sources/SplitViewKit/SplitViewContainer+Content.swift @@ -29,6 +29,11 @@ extension SplitViewContainer { } else if newValue == .regular { print("👉 Switched to regular size class") } + refreshID = UUID() + } + .onChange(of: winWidth) { oldValue, newValue in + Swift.print("winWidth changed - oldValue: \(oldValue), newValue: \(newValue)") + refreshID = UUID() } } } @@ -58,6 +63,7 @@ extension SplitViewContainer { } }() navigationSplitView() + .id(refreshID) } } /** diff --git a/Sources/SplitViewKit/SplitViewContainer.swift b/Sources/SplitViewKit/SplitViewContainer.swift index 44aab27..b07d26f 100644 --- a/Sources/SplitViewKit/SplitViewContainer.swift +++ b/Sources/SplitViewKit/SplitViewContainer.swift @@ -61,7 +61,7 @@ public struct SplitViewContainer: Vi // /*@State */internal var geometryChange: GeometryChange? // As a last resort, you can force a view to redraw by changing its identity: // add .id(refreshID) on view and call refreshID = UUID() in an update -// @State internal var refreshID = UUID() + @State internal var refreshID = UUID() @State internal var winWidth: CGFloat = .zero /** * Init