From d25283b8ad3dc4ce2bc8591d56fe60ab26f7da95 Mon Sep 17 00:00:00 2001 From: Dominic Go <18517029+dominicstop@users.noreply.github.com> Date: Fri, 12 May 2023 13:27:53 +0800 Subject: [PATCH] =?UTF-8?q?=E2=AD=90=EF=B8=8F=20Impl:=20Add=20`RNIModalErr?= =?UTF-8?q?or`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Related: * `TODO:2023-03-27-23-55-09` Refactor: Re-write `RNIModalView` error creation and handling. --- .../React Native/RNIModal/RNIModalError.swift | 41 +++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 ios/src_library/React Native/RNIModal/RNIModalError.swift diff --git a/ios/src_library/React Native/RNIModal/RNIModalError.swift b/ios/src_library/React Native/RNIModal/RNIModalError.swift new file mode 100644 index 00000000..462f30da --- /dev/null +++ b/ios/src_library/React Native/RNIModal/RNIModalError.swift @@ -0,0 +1,41 @@ +// +// RNIModalError.swift +// react-native-ios-modal +// +// Created by Dominic Go on 5/10/23. +// + +import Foundation + +public enum RNIModalErrorCode: String, RNIErrorCode { + case modalAlreadyVisible, + modalAlreadyHidden, + dismissRejected; +}; + +public struct RNIModalError: RNIError { + + public typealias ErrorCode = RNIModalErrorCode; + + public static var domain = "react-native-ios-modal"; + + public var code: RNIModalErrorCode; + public var message: String?; + + public var debugMessage: String?; + public var debugData: Dictionary?; + + public var fileID: String?; + public var functionName: String?; + public var lineNumber: Int?; + + public init( + code: ErrorCode, + message: String?, + debugMessage: String? + ) { + self.code = code; + self.message = message; + self.debugMessage = debugMessage; + }; +};