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 10, 2023
1 parent 5a29f46 commit c69f25c
Showing 1 changed file with 8 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class AdaptiveModalManager: NSObject {
// ------------------------------------------

/// The computed frames of the modal based on the snap points
private(set) var interpolationSteps: [AdaptiveModalInterpolationPoint]!;
private(set) var rawInterpolationSteps: [AdaptiveModalInterpolationPoint]!;

var prevInterpolationIndex = 0;
var nextInterpolationIndex: Int?;
Expand All @@ -84,13 +84,12 @@ class AdaptiveModalManager: NSObject {
};

// sorted based on the modal direction
var interpolationStepsSorted: [AdaptiveModalInterpolationPoint]? {
guard let interpolationSteps = self.interpolationSteps else { return nil };
return self.modalConfig.sortInterpolationSteps(interpolationSteps);
var interpolationSteps: [AdaptiveModalInterpolationPoint]! {
self.modalConfig.sortInterpolationSteps(self.rawInterpolationSteps);
};

var interpolationRangeInput: [CGFloat]? {
self.interpolationStepsSorted?.map {
var interpolationRangeInput: [CGFloat]! {
self.interpolationSteps.map {
$0.percent
};
};
Expand Down Expand Up @@ -393,7 +392,7 @@ class AdaptiveModalManager: NSObject {
shouldClampMax: Bool = false
) -> CGFloat? {

guard let interpolationSteps = rangeOutput ?? self.interpolationStepsSorted,
guard let interpolationSteps = rangeOutput ?? self.interpolationSteps,
let interpolationRangeInput = rangeInput ?? self.interpolationRangeInput
else { return nil };

Expand All @@ -417,7 +416,7 @@ class AdaptiveModalManager: NSObject {
shouldClampMax: Bool = false
) -> UIColor? {

guard let interpolationSteps = rangeOutput ?? self.interpolationStepsSorted,
guard let interpolationSteps = rangeOutput ?? self.interpolationSteps,
let interpolationRangeInput = rangeInput ?? self.interpolationRangeInput
else { return nil };

Expand Down Expand Up @@ -1112,7 +1111,7 @@ class AdaptiveModalManager: NSObject {
) {
let context = context ?? self.layoutValueContext;

self.interpolationSteps = .Element.compute(
self.rawInterpolationSteps = .Element.compute(
usingModalConfig: self.modalConfig,
layoutValueContext: context
);
Expand Down

0 comments on commit c69f25c

Please sign in to comment.