Skip to content

Commit

Permalink
💫 Update: Exp - AdaptiveModal
Browse files Browse the repository at this point in the history
Summary: Update experiment/test - `swift-programmatic-modal/AdaptiveModal`.
  • Loading branch information
dominicstop committed Jun 6, 2023
1 parent 71e9bc5 commit ef28916
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -246,8 +246,23 @@ struct AdaptiveModalInterpolationPoint: Equatable {
modalView.transform = self.modalTransform;
modalView.alpha = self.modalOpacity;

modalView.layer.cornerRadius = self.modalCornerRadius;
modalView.layer.maskedCorners = self.modalMaskedCorners;
modalView.layer.mask = {
let path = UIBezierPath(
shouldRoundRect: modalView.bounds,
topLeftRadius: 20,
topRightRadius: 20,
bottomLeftRadius: 20,
bottomRightRadius: 20
);

let shape = CAShapeLayer();
shape.path = path.cgPath;

return shape;
}();

//modalView.layer.cornerRadius = self.modalCornerRadius;
//modalView.layer.maskedCorners = self.modalMaskedCorners;
};

func apply(toModalWrapperView modalWrapperView: UIView){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -693,13 +693,28 @@ class AdaptiveModalManager {
)
);

AdaptiveModalUtilities.unwrapAndSetProperty(
forObject: modalView,
forPropertyKey: \.layer.cornerRadius,
withValue: self.interpolateModalBorderRadius(
forInputPercentValue: inputPercentValue
)
);
// AdaptiveModalUtilities.unwrapAndSetProperty(
// forObject: modalView,
// forPropertyKey: \.layer.cornerRadius,
// withValue: self.interpolateModalBorderRadius(
// forInputPercentValue: inputPercentValue
// )
// );

modalView.layer.mask = {
let path = UIBezierPath(
shouldRoundRect: modalView.bounds,
topLeftRadius: 20,
topRightRadius: 20,
bottomLeftRadius: 20,
bottomRightRadius: 20
);

let shape = CAShapeLayer();
shape.path = path.cgPath;

return shape;
}();

AdaptiveModalUtilities.unwrapAndSetProperty(
forObject: self.modalBackgroundView,
Expand Down

0 comments on commit ef28916

Please sign in to comment.