diff --git a/ios/Temp/ModalSheetState.swift b/ios/Temp/ModalSheetState.swift new file mode 100644 index 00000000..e1d572cb --- /dev/null +++ b/ios/Temp/ModalSheetState.swift @@ -0,0 +1,65 @@ +// +// ModalSheetState.swift +// react-native-ios-modal +// +// Created by Dominic Go on 9/27/24. +// + +import Foundation + + +public enum ModalSheetState: String { + + case presenting; + case dismissViaGestureCancelling; + + case presented; + case dismissViaGestureCancelled; + + case dismissing; + case dismissingViaGesture; + case presentingViaGestureCanceling; + + case dismissed; + case dismissedViaGesture; + case presentingViaGestureCancelled; + + // MARK: - Computed Properties + // --------------------------- + + public var modalState: ModalState { + switch self { + case .presenting, .dismissViaGestureCancelling: + return .presenting; + + case .presented, .dismissViaGestureCancelled: + return .presented; + + case .dismissing, .dismissingViaGesture, .presentingViaGestureCanceling: + return .dismissing; + + case .dismissed, .dismissedViaGesture, .presentingViaGestureCancelled: + return .dismissed; + }; + }; + + public var isPresenting: Bool { + self.modalState.isPresenting; + }; + + public var isPresented: Bool { + self.modalState.isPresented; + }; + + public var isDismissing: Bool { + self.modalState.isDismissing; + }; + + public var isDismissed: Bool { + self.modalState.isDismissed; + }; + + public var simplified: Self { + self.modalState.modalSheetState; + }; +}; diff --git a/ios/Temp/ModalState.swift b/ios/Temp/ModalState.swift new file mode 100644 index 00000000..86332b71 --- /dev/null +++ b/ios/Temp/ModalState.swift @@ -0,0 +1,52 @@ +// +// ModalState.swift +// react-native-ios-modal +// +// Created by Dominic Go on 9/27/24. +// + +import Foundation + + +public enum ModalState: String { + + case presenting; + case presented; + case dismissing; + case dismissed; + + // MARK: - Computed Properties + // --------------------------- + + public var isPresenting: Bool { + self == .presenting; + }; + + public var isPresented: Bool { + self == .presented; + }; + + public var isDismissing: Bool { + self == .dismissing; + }; + + public var isDismissed: Bool { + self == .dismissed; + }; + + public var modalSheetState: ModalSheetState { + switch self { + case .presenting: + return .presenting; + + case .presented: + return .presented; + + case .dismissing: + return .dismissing; + + case .dismissed: + return .dismissed; + }; + }; +};