@@ -28,10 +28,6 @@ public struct Drawer<Content>: View where Content: View {
2828 /// A callback executed when the drawer reaches a restingHeight
2929 internal var didRest : ( ( _ height: CGFloat ) -> ( ) ) ? = nil
3030
31- @Binding internal var locked : Bool
32-
33- internal var lockedHeight : ( _ restingHeight: CGFloat ) -> CGFloat
34-
3531 // MARK: Orientation
3632
3733 public struct SizeClass : Equatable {
@@ -50,12 +46,6 @@ public struct Drawer<Content>: View where Content: View {
5046 /// A callback executed when the drawer is layed out for a new size class
5147 internal var didLayoutForSizeClass : ( ( SizeClass ) -> ( ) ) ? = nil
5248
53- // MARK: Width
54-
55- @Binding internal var alignment : DrawerAlignment
56-
57- @Binding internal var fixedWidth : CGFloat ?
58-
5949 // MARK: Gestures
6050
6151 @State internal var dragging : Bool = false
@@ -94,61 +84,11 @@ public extension Drawer {
9484 self . _height = . init( initialValue: startingHeight ?? heights. wrappedValue. first!)
9585 self . _restingHeight = . init( initialValue: startingHeight ?? heights. wrappedValue. first!)
9686 self . content = content ( )
97- self . _locked = . constant( false )
98- self . lockedHeight = { _ in return CGFloat . zero }
99- self . _alignment = . constant( . fullscreen)
100- self . _fixedWidth = . constant( nil )
101- }
102-
103- /// A bottom-up view that conforms to multiple heights
104- /// - Parameters:
105- /// - heights: The possible resting heights of the drawer
106- /// - startingHeight: The starting height of the drawer. Defaults to the first height marker if not specified
107- /// - content: The view that defines the drawer
108- @available ( * , deprecated)
109- init (
110- heights: [ CGFloat ] ,
111- startingHeight: CGFloat ? = nil ,
112- @ViewBuilder _ content: ( ) -> Content
113- ) {
114- self . _heights = . constant( heights)
115- self . _height = . init( initialValue: startingHeight ?? heights. first!)
116- self . _restingHeight = . init( initialValue: startingHeight ?? heights. first!)
117- self . content = content ( )
118- self . _locked = . constant( false )
119- self . lockedHeight = { _ in return CGFloat . zero }
120- self . _alignment = . constant( . fullscreen)
121- self . _fixedWidth = . constant( nil )
122- }
123-
124- // MARK: Deprecated Inits
125-
126- /// A bottom-up view that conforms to multiple heights
127- /// - Parameters:
128- /// - heights: The possible resting heights of the drawer
129- /// - startingHeight: The starting height of the drawer. Defaults to the first height marker if not specified
130- /// - content: The view that defines the drawer
131- @available ( * , deprecated)
132- init (
133- heights: [ CGFloat ] ,
134- startingHeight: CGFloat ? = nil ,
135- impact: UIImpactFeedbackGenerator . FeedbackStyle ? ,
136- @ViewBuilder _ content: ( ) -> Content
137- ) {
138- self . _heights = . constant( heights)
139- self . _height = . init( initialValue: startingHeight ?? heights. first!)
140- self . _restingHeight = . init( initialValue: startingHeight ?? heights. first!)
141- self . content = content ( )
142- if let impact = impact {
143- self . impactGenerator = UIImpactFeedbackGenerator ( style: impact)
144- }
145- self . _locked = . constant( false )
146- self . lockedHeight = { _ in return CGFloat . zero }
147- self . _alignment = . constant( . fullscreen)
148- self . _fixedWidth = . constant( nil )
14987 }
15088}
15189
90+ // MARK: Internal Init
91+
15292internal extension Drawer {
15393 init (
15494 heights: Binding < [ CGFloat ] > ,
@@ -157,11 +97,7 @@ internal extension Drawer {
15797 springHeight: CGFloat ,
15898 didRest: ( ( _ height: CGFloat ) -> ( ) ) ? ,
15999 didLayoutForSizeClass: ( ( SizeClass ) -> ( ) ) ? ,
160- alignment: Binding < DrawerAlignment > ,
161- width: Binding < CGFloat ? > ,
162100 impactGenerator: UIImpactFeedbackGenerator ? ,
163- locked: Binding < Bool > ,
164- lockedHeight: @escaping ( CGFloat ) -> CGFloat ,
165101 content: Content
166102 ) {
167103 self . _heights = heights
@@ -170,13 +106,8 @@ internal extension Drawer {
170106 self . springHeight = springHeight
171107 self . didRest = didRest
172108 self . didLayoutForSizeClass = didLayoutForSizeClass
173- self . _fixedWidth = width
174- self . _alignment = alignment
175109 self . content = content
176110 self . impactGenerator = impactGenerator
177- self . lockedHeight = lockedHeight
178- self . _locked = locked
179-
180111 }
181112}
182113
0 commit comments