Skip to content

Commit c79f3b4

Browse files
committed
Revert "Add absoluteInsets size option"
This reverts commit cc1b635.
1 parent 6dd1a1c commit c79f3b4

File tree

2 files changed

+5
-22
lines changed

2 files changed

+5
-22
lines changed

SwiftMessages/Layout.swift

-11
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ public struct Layout {
3535
public enum Dimension {
3636
case absolute(CGFloat)
3737
case relative(CGFloat, to: Boundary)
38-
case absoluteInsets(CGFloat, to: Boundary)
3938
}
4039

4140
public var width: Dimension?
@@ -82,16 +81,6 @@ extension Layout.Insets.Dimension {
8281
}
8382
}
8483

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-
9584
extension Layout.Center.Dimension {
9685
var boundary: Layout.Boundary {
9786
switch self {

SwiftMessages/MaskingView.swift

+5-11
Original file line numberDiff line numberDiff line change
@@ -417,8 +417,10 @@ class MaskingView: PassthroughView, LayoutInstalling {
417417
for dimension: Layout.Size.Dimension,
418418
extractor: (CGRect) -> CGFloat
419419
) -> 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):
422424
let insets: UIEdgeInsets
423425
switch boundary {
424426
case .superview: insets = .zero
@@ -430,15 +432,7 @@ class MaskingView: PassthroughView, LayoutInstalling {
430432
insets = layoutMargins
431433
}
432434
}
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
442436
}
443437
}
444438

0 commit comments

Comments
 (0)