diff --git a/experiments/swift-programmatic-modal/AdaptiveModal/AdaptiveModalInterpolationPoint.swift b/experiments/swift-programmatic-modal/AdaptiveModal/AdaptiveModalInterpolationPoint.swift index 25608699..fda9663d 100644 --- a/experiments/swift-programmatic-modal/AdaptiveModal/AdaptiveModalInterpolationPoint.swift +++ b/experiments/swift-programmatic-modal/AdaptiveModal/AdaptiveModalInterpolationPoint.swift @@ -18,13 +18,11 @@ struct AdaptiveModalInterpolationPoint { let modalRadiusBottomRight: CGFloat; var modalRadiusMask: CAShapeLayer { - let bounds = CGRect( - origin: .zero, - size: self.computedRect.size - ); - let radiusPath = UIBezierPath( - shouldRoundRect: bounds, + shouldRoundRect: CGRect( + origin: .zero, + size: self.computedRect.size + ), topLeftRadius: self.modalRadiusTopLeft, topRightRadius: self.modalRadiusTopRight, bottomLeftRadius: self.modalRadiusBottomLeft, diff --git a/experiments/swift-programmatic-modal/AdaptiveModal/AdaptiveModalManager.swift b/experiments/swift-programmatic-modal/AdaptiveModal/AdaptiveModalManager.swift index 58f6a284..9aa3cb11 100644 --- a/experiments/swift-programmatic-modal/AdaptiveModal/AdaptiveModalManager.swift +++ b/experiments/swift-programmatic-modal/AdaptiveModal/AdaptiveModalManager.swift @@ -7,32 +7,6 @@ import UIKit -class MaskedView: UIView { - var maskShape: CAShapeLayer?; - - var maskingView: UIView?; - - override init(frame: CGRect) { - self.maskingView = UIView(frame: frame); - self.maskingView!.backgroundColor = .blue; - - super.init(frame: frame); - - self.mask = self.maskingView; - }; - - required init?(coder: NSCoder) { - fatalError("init(coder:) has not been implemented") - } - - override func layoutSubviews() { - super.layoutSubviews(); - - self.maskingView!.frame = self.frame; - print("MaskedView.layoutSubviews - frame: \(self.frame)") - }; -}; - class AdaptiveModalManager { @@ -50,7 +24,7 @@ class AdaptiveModalManager { var currentSizeProvider: () -> CGSize; weak var targetView: UIView?; - weak var modalView: MaskedView?; + weak var modalView: UIView?; var gestureOffset: CGFloat?; var gestureVelocity: CGPoint?; @@ -176,7 +150,7 @@ class AdaptiveModalManager { init( modalConfig: AdaptiveModalConfig, - modalView: MaskedView, + modalView: UIView, targetView: UIView, currentSizeProvider: @escaping () -> CGSize ) { @@ -353,7 +327,7 @@ class AdaptiveModalManager { forInputValue: gestureInput, modalBounds: modalView.bounds ) { - modalView.maskShape = modalBorderRadiusMask; + modalView.layer.mask = modalBorderRadiusMask; }; }; @@ -409,8 +383,6 @@ class AdaptiveModalManager { animator.addAnimations { modalView.frame = interpolationPoint.computedRect; - modalView.maskShape = interpolationPoint.modalRadiusMask; - modalView.layoutSubviews(); }; if let completion = completion { @@ -420,7 +392,7 @@ class AdaptiveModalManager { animator.addCompletion { _ in self.animator = nil; }; - + animator.startAnimation(); }; @@ -521,7 +493,6 @@ class AdaptiveModalManager { }; @objc func onDisplayLinkTick(displayLink: CADisplayLink){ - return; /// `Note:2023-05-30-16-13-29` /// /// The interpolation can be driven by either via **Method-A** or diff --git a/experiments/swift-programmatic-modal/AdaptiveModal/UIBezierPath+VariadicCornerRadius.swift b/experiments/swift-programmatic-modal/AdaptiveModal/UIBezierPath+VariadicCornerRadius.swift index ebe425a3..5b3cfcc8 100644 --- a/experiments/swift-programmatic-modal/AdaptiveModal/UIBezierPath+VariadicCornerRadius.swift +++ b/experiments/swift-programmatic-modal/AdaptiveModal/UIBezierPath+VariadicCornerRadius.swift @@ -110,8 +110,6 @@ extension UIBezierPath { } else { path.addLine(to: topLeft); }; - - path.closeSubpath(); cgPath = path; diff --git a/experiments/swift-programmatic-modal/Test/RNIDraggableTestViewController.swift b/experiments/swift-programmatic-modal/Test/RNIDraggableTestViewController.swift index e236e97c..f95c994f 100644 --- a/experiments/swift-programmatic-modal/Test/RNIDraggableTestViewController.swift +++ b/experiments/swift-programmatic-modal/Test/RNIDraggableTestViewController.swift @@ -136,8 +136,8 @@ class RNIDraggableTestViewController : UIViewController { return label; }(); - lazy var floatingView: MaskedView = { - let view = MaskedView(); + lazy var floatingView: UIView = { + let view = UIView(); view.backgroundColor = UIColor( hue: 0/360,