File tree 2 files changed +5
-22
lines changed
2 files changed +5
-22
lines changed Original file line number Diff line number Diff line change @@ -35,7 +35,6 @@ public struct Layout {
35
35
public enum Dimension {
36
36
case absolute( CGFloat )
37
37
case relative( CGFloat , to: Boundary )
38
- case absoluteInsets( CGFloat , to: Boundary )
39
38
}
40
39
41
40
public var width : Dimension ?
@@ -82,16 +81,6 @@ extension Layout.Insets.Dimension {
82
81
}
83
82
}
84
83
85
- extension Layout . Size . Dimension {
86
- var boundary : Layout . Boundary ? {
87
- switch self {
88
- case . absolute( _) : return nil
89
- case . relative( _, let boundary) : return boundary
90
- case . absoluteInsets( _, let boundary) : return boundary
91
- }
92
- }
93
- }
94
-
95
84
extension Layout . Center . Dimension {
96
85
var boundary : Layout . Boundary {
97
86
switch self {
Original file line number Diff line number Diff line change @@ -417,8 +417,10 @@ class MaskingView: PassthroughView, LayoutInstalling {
417
417
for dimension: Layout . Size . Dimension ,
418
418
extractor: ( CGRect ) -> CGFloat
419
419
) -> CGFloat {
420
- let insetBounds : CGRect = {
421
- guard let boundary = dimension. boundary else { return . zero }
420
+ switch dimension {
421
+ case . absolute( let dimension) :
422
+ return dimension
423
+ case . relative( let percentage, let boundary) :
422
424
let insets : UIEdgeInsets
423
425
switch boundary {
424
426
case . superview: insets = . zero
@@ -430,15 +432,7 @@ class MaskingView: PassthroughView, LayoutInstalling {
430
432
insets = layoutMargins
431
433
}
432
434
}
433
- return bounds. inset ( by: insets)
434
- } ( )
435
- switch dimension {
436
- case . absolute( let dimension) :
437
- return dimension
438
- case . relative( let percentage, _) :
439
- return extractor ( insetBounds) * percentage
440
- case . absoluteInsets( let dimension, _) :
441
- return extractor ( insetBounds) - dimension * 2
435
+ return extractor ( bounds. inset ( by: insets) ) * percentage
442
436
}
443
437
}
444
438
You can’t perform that action at this time.
0 commit comments