File tree 3 files changed +26
-0
lines changed
3 files changed +26
-0
lines changed Original file line number Diff line number Diff line change
1
+ {
2
+ "pins" : [
3
+ {
4
+ "identity" : " swiftui-introspect" ,
5
+ "kind" : " remoteSourceControl" ,
6
+ "location" : " https://github.com/siteline/swiftui-introspect" ,
7
+ "state" : {
8
+ "revision" : " 807f73ce09a9b9723f12385e592b4e0aaebd3336" ,
9
+ "version" : " 1.3.0"
10
+ }
11
+ }
12
+ ],
13
+ "version" : 2
14
+ }
Original file line number Diff line number Diff line change @@ -77,27 +77,33 @@ struct OrientationChangeModifier: ViewModifier {
77
77
func body( content: Content ) -> some View {
78
78
content
79
79
. onAppear {
80
+ #if os(iOS)
80
81
NotificationCenter . default. addObserver ( forName: UIDevice . orientationDidChangeNotification, object: nil , queue: . main) { _ in
81
82
updateOrientation ( )
82
83
}
83
84
updateOrientation ( )
85
+ #endif
84
86
}
85
87
. onDisappear {
88
+ #if os(iOS)
86
89
NotificationCenter . default. removeObserver ( self , name: UIDevice . orientationDidChangeNotification, object: nil )
90
+ #endif
87
91
}
88
92
. onChange ( of: isLandscape) { _ in
89
93
onOrientationChange ( )
90
94
}
91
95
}
92
96
93
97
private func updateOrientation( ) {
98
+ #if os(iOS)
94
99
DispatchQueue . main. async {
95
100
let newIsLandscape = UIDevice . current. orientation. isLandscape
96
101
if newIsLandscape != isLandscape {
97
102
isLandscape = newIsLandscape
98
103
onOrientationChange ( )
99
104
}
100
105
}
106
+ #endif
101
107
}
102
108
}
103
109
Original file line number Diff line number Diff line change @@ -390,7 +390,9 @@ public struct Popup<PopupContent: View>: ViewModifier {
390
390
/// Variables used to control what is animated and what is not
391
391
@State var actualCurrentOffset = CGPoint . pointFarAwayFromScreen
392
392
@State var actualScale = 1.0
393
+ #if os(iOS)
393
394
@State private var isLandscape : Bool = UIDevice . current. orientation. isLandscape
395
+ #endif
394
396
// MARK: - Drag to dismiss
395
397
396
398
/// Drag to dismiss gesture state
@@ -707,9 +709,11 @@ public struct Popup<PopupContent: View>: ViewModifier {
707
709
. onChange ( of: sheetContentRect. size) { sheetContentRect in
708
710
positionIsCalculatedCallback ( )
709
711
}
712
+ #if os(iOS)
710
713
. onOrientationChange( isLandscape: $isLandscape) {
711
714
actualCurrentOffset = targetCurrentOffset
712
715
}
716
+ #endif
713
717
}
714
718
} else { // ios 16
715
719
ZStack {
@@ -750,9 +754,11 @@ public struct Popup<PopupContent: View>: ViewModifier {
750
754
. onChange ( of: sheetContentRect. size) { sheetContentRect in
751
755
positionIsCalculatedCallback ( )
752
756
}
757
+ #if os(iOS)
753
758
. onOrientationChange( isLandscape: $isLandscape) {
754
759
actualCurrentOffset = targetCurrentOffset
755
760
}
761
+ #endif
756
762
}
757
763
}
758
764
}
You can’t perform that action at this time.
0 commit comments