Skip to content

Commit

Permalink
💫 Update: ModalSheetState
Browse files Browse the repository at this point in the history
  • Loading branch information
dominicstop committed Sep 29, 2024
1 parent 3d33aa6 commit 4e497cb
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions ios/Temp/ModalSheetState.swift
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ public enum ModalSheetState: String {
self.modalState.isDismissed;
};

public var isDraggingViaGesture: Bool {
self == .draggingViaGesture;
};

public var isInPresentation: Bool {
!self.isDraggingViaGesture
&& self.modalState.isInPresentation
Expand All @@ -79,4 +83,28 @@ public enum ModalSheetState: String {
public var simplified: Self {
self.modalState.modalSheetState;
};

public var isSpecific: Bool {
self.simplified != self;
};

// MARK: - Functions
// -----------------

public func isSameStep(comparedTo otherState: Self) -> Bool {
self.simplified == otherState.simplified;
};

public func isGeneric(comparedTo otherState: Self) -> Bool {
switch(self, otherState){
case (.draggingViaGesture, let otherState) where otherState.isInPresentation:
return false;

case (let currentState, .draggingViaGesture) where currentState.isInPresentation:
return false;

default:
return self.isSpecific && !otherState.isSpecific
};
};
};

0 comments on commit 4e497cb

Please sign in to comment.