Skip to content

Commit

Permalink
Reorder geometryChange cases
Browse files Browse the repository at this point in the history
  • Loading branch information
eonist committed Oct 23, 2024
1 parent f8e2fae commit 4a161f0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 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" : "4775655ebbb142063d93406d02a0e8c9f881480a"
"revision" : "f8e2fae61676720ee9912b94eb43cea358d43dfd"
}
}
],
Expand Down
9 changes: 5 additions & 4 deletions Sources/SplitViewKit/util/GeometryChange.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,17 @@ import SwiftUI
// - Fixme: ⚠️️ add doc
// - Fixme: ⚠️️ we might be able to make this a stateobject and use the DeviceOrientation
// - Fixme: ⚠️️ move to columWidth file?
// - Fixme: ⚠️️ we might have to account for all cases, lets see if reordering the cases works first
func geometryChange(isLandscape: Bool, sizeClass: UserInterfaceSizeClass?, winWidth: CGFloat, closure: (_ winWidth: CGFloat) -> some View) -> some View {
switch true {
case isLandscape:
Swift.print("👉 isLandscape")
case /*columnWidth.*/isNarrow(isLandscape: isLandscape, winWidth: winWidth):
Swift.print("👉 isNarrow")
return closure(winWidth)
case sizeClass == .compact:
Swift.print("👉 compact")
return closure(winWidth)
case /*columnWidth.*/isNarrow(isLandscape: isLandscape, winWidth: winWidth):
Swift.print("👉 isNarrow")
case isLandscape:
Swift.print("👉 isLandscape")
return closure(winWidth)
default:
Swift.print("👉 default")
Expand Down

0 comments on commit 4a161f0

Please sign in to comment.