Skip to content

Commit

Permalink
Remove closure
Browse files Browse the repository at this point in the history
  • Loading branch information
eonist committed Oct 23, 2024
1 parent 5cea6fd commit 0d6b805
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"location" : "https://github.com/sentryco/SplitViewKit",
"state" : {
"branch" : "main",
"revision" : "c949d6cafb85c2fa288a3d3a3ca8177c9a13e0c5"
"revision" : "5cea6fd943e8f9dcc70902091bf856070c2abae2"
}
}
],
Expand Down
14 changes: 7 additions & 7 deletions Sources/SplitViewKit/SplitViewContainer+Content.swift
Original file line number Diff line number Diff line change
Expand Up @@ -57,24 +57,24 @@ extension SplitViewContainer {
geometryChange(
// isLandscape: ,
//sizeClass: sizeClass.reBind,
geometry: geometry,
closure: navigationSplitView
geometry: geometry
// closure: navigationSplitView
)
}
}
func geometryChange(/*isLandscape: Bool, */geometry: GeometryProxy, closure: (_ winWidth: CGFloat) -> some View) -> some View {
func geometryChange(/*isLandscape: Bool, */geometry: GeometryProxy /*closure: (_ winWidth: CGFloat) -> some View*/) -> some View {
if isLandscape { // - Fixme: ⚠️️ Add doc
if sizeClass == .compact { // this fixes things going into compact. but not 70% to regular
closure(geometry.size.width) // ⚠️️ This is the same as the other, but it refreshes the view, and recalculates columnwidths etc, which is what we need
navigationSplitView(geometry.size.width) // ⚠️️ This is the same as the other, but it refreshes the view, and recalculates columnwidths etc, which is what we need
} else { // if sizeClass == .regular
if isNarrow(isLandscape: isLandscape, winWidth: geometry.size.width) {
closure(geometry.size.width) // ⚠️️ This is the same as the other, but it refreshes the view, and recalculates columnwidths etc, which is what we need
navigationSplitView(geometry.size.width) // ⚠️️ This is the same as the other, but it refreshes the view, and recalculates columnwidths etc, which is what we need
} else {
closure(geometry.size.width) // ⚠️️ This is the same as the other, but it refreshes the view, and recalculates columnwidths etc, which is what we need
navigationSplitView(geometry.size.width) // ⚠️️ This is the same as the other, but it refreshes the view, and recalculates columnwidths etc, which is what we need
}
}
} else {
closure(geometry.size.width) // ⚠️️ We can't load the same variable, or else it will not refresh. so we reference it again like this to referesh. seems strange but it is what it is, there might be another solution to this stange behaviour, more exploration could be ideal
navigationSplitView(geometry.size.width) // ⚠️️ We can't load the same variable, or else it will not refresh. so we reference it again like this to referesh. seems strange but it is what it is, there might be another solution to this stange behaviour, more exploration could be ideal
}
}
/**
Expand Down

0 comments on commit 0d6b805

Please sign in to comment.