You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: FrameLayoutKit/Classes/FrameLayout.swift
+3Lines changed: 3 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -28,6 +28,9 @@ public enum NKContentHorizontalAlignment {
28
28
FrameLayout is the fundamental component of the kit. This class will automatically adjust the size and position of the view assigned to it based on the size and position of the frameLayout itself, and the specified alignment value.
29
29
*/
30
30
openclassFrameLayout:UIView{
31
+
/// Show warnings on debug console when adding a UIControl without `isUserInteractionEnabled` turned on, which will make that control untouchabe
32
+
publicstaticvarshowDebugWarnings=false
33
+
31
34
/// Target view that handled by this frameLayout
32
35
publicvartargetView:UIView?
33
36
/// Additional views that will have their frames binding to `targetView`'s frame
Copy file name to clipboardExpand all lines: FrameLayoutKit/Classes/StackFrameLayout.swift
+9-19Lines changed: 9 additions & 19 deletions
Original file line number
Diff line number
Diff line change
@@ -20,21 +20,15 @@ open class StackFrameLayout: FrameLayout {
20
20
}
21
21
22
22
publicvarisOverlapped:Bool=false{
23
-
didSet {
24
-
setNeedsLayout()
25
-
}
23
+
didSet {setNeedsLayout()}
26
24
}
27
25
28
26
publicvarisJustified:Bool=false{
29
-
didSet {
30
-
setNeedsLayout()
31
-
}
27
+
didSet {setNeedsLayout()}
32
28
}
33
29
34
30
publicvarjustifyThreshold:CGFloat=0.0{
35
-
didSet {
36
-
setNeedsLayout()
37
-
}
31
+
didSet {setNeedsLayout()}
38
32
}
39
33
40
34
overrideopenvarignoreHiddenView:Bool{
@@ -105,15 +99,11 @@ open class StackFrameLayout: FrameLayout {
105
99
}
106
100
107
101
overrideopenvarframe:CGRect{
108
-
didSet {
109
-
setNeedsLayout()
110
-
}
102
+
didSet {setNeedsLayout()}
111
103
}
112
104
113
105
overrideopenvarbounds:CGRect{
114
-
didSet {
115
-
setNeedsLayout()
116
-
}
106
+
didSet {setNeedsLayout()}
117
107
}
118
108
119
109
overrideopenvarclipsToBounds:Bool{
@@ -188,18 +178,17 @@ open class StackFrameLayout: FrameLayout {
188
178
}
189
179
else{
190
180
iflet view = view, view.superview ==nil{
191
-
/*
192
181
#if DEBUG
193
-
if !isUserInteractionEnabled, view is UIControl {
182
+
ifFrameLayout.showDebugWarnings,!isUserInteractionEnabled, view is UIControl{
194
183
print("⚠️ [FrameLayoutKit] \(view) was automatically added to StackFrameLayout \(self) which was disabled user interation. This could make your control unable to interact. You can either set isUserInteractionEnabled = true for this FrameLayout or addSubview(your control) before adding to frameLayout.")
195
184
}
196
185
#endif
197
-
*/
198
186
addSubview(view)
199
187
}
200
188
201
189
letframeLayout=FrameLayout(targetView: view)
202
190
frameLayout.debug = debug
191
+
frameLayout.debugColor = debugColor
203
192
frameLayout.ignoreHiddenView = ignoreHiddenView
204
193
frameLayout.fixedContentSize = fixedItemSize
205
194
frameLayout.minContentSize = minItemSize
@@ -220,7 +209,7 @@ open class StackFrameLayout: FrameLayout {
220
209
else{
221
210
iflet view = view, view.superview ==nil{
222
211
#if DEBUG
223
-
if !isUserInteractionEnabled, view is UIControl{
212
+
ifFrameLayout.showDebugWarnings,!isUserInteractionEnabled, view is UIControl{
224
213
print("⚠️ [FrameLayoutKit] \(view) was automatically added to StackFrameLayout \(self) which was disabled user interation. This could make your control unable to interact. You can either set isUserInteractionEnabled = true for this FrameLayout or addSubview(your control) before adding to frameLayout.")
225
214
}
226
215
#endif
@@ -229,6 +218,7 @@ open class StackFrameLayout: FrameLayout {
0 commit comments