From ecf960a1e1c5fb441e79174e1fcf1617729574d1 Mon Sep 17 00:00:00 2001 From: Dominic Go <18517029+dominicstop@users.noreply.github.com> Date: Fri, 7 Apr 2023 09:23:00 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=9B=A0=20Refactor:=20Update=20Access=20-?= =?UTF-8?q?=20Make=20Types=20Public?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../UIModalTransitionStyle+Helpers.swift | 4 +- .../Extensions/UIView+Helpers.swift | 4 +- .../Helpers+Utilities/MulticastDelegate.swift | 8 +-- .../RNIDictionarySynthesizable.swift | 2 +- .../Helpers+Utilities/RNIIdentifiable.swift | 6 +- ...RNIViewControllerLifeCycleNotifiable.swift | 18 ++--- .../Helpers+Utilities/WeakElement.swift | 2 +- .../RNIModal/RNIModal+Helpers.swift | 16 ++--- .../React Native/RNIModal/RNIModalData.swift | 20 +++--- .../RNIModal/RNIModalEvents.swift | 12 ++-- .../RNIModal/RNIModalManager.swift | 4 +- .../RNIModal/RNIModalPresentationState.swift | 32 ++++----- .../RNIModalView/RNIModalView.swift | 66 +++++++++---------- .../RNIModalView/RNIModalViewController.swift | 20 +++--- .../React Native/RNIWeak/RNIWeakArray.swift | 8 +-- 15 files changed, 111 insertions(+), 111 deletions(-) diff --git a/ios/src_library/Extensions/UIModalTransitionStyle+Helpers.swift b/ios/src_library/Extensions/UIModalTransitionStyle+Helpers.swift index f7b08621..3394a703 100644 --- a/ios/src_library/Extensions/UIModalTransitionStyle+Helpers.swift +++ b/ios/src_library/Extensions/UIModalTransitionStyle+Helpers.swift @@ -17,7 +17,7 @@ extension UIModalTransitionStyle: CaseIterable { ]; }; - func stringDescription() -> String { + public func stringDescription() -> String { switch self { case .coverVertical : return "coverVertical"; case .flipHorizontal: return "flipHorizontal"; @@ -28,7 +28,7 @@ extension UIModalTransitionStyle: CaseIterable { }; }; - static func fromString(_ string: String) -> UIModalTransitionStyle? { + public static func fromString(_ string: String) -> UIModalTransitionStyle? { return self.allCases.first{ $0.stringDescription() == string }; }; }; diff --git a/ios/src_library/Extensions/UIView+Helpers.swift b/ios/src_library/Extensions/UIView+Helpers.swift index 575b5708..322f91cb 100644 --- a/ios/src_library/Extensions/UIView+Helpers.swift +++ b/ios/src_library/Extensions/UIView+Helpers.swift @@ -3,7 +3,7 @@ /// `react-native-utilities` /// extension UIView { - var parentViewController: UIViewController? { + public var parentViewController: UIViewController? { var parentResponder: UIResponder? = self; while parentResponder != nil { @@ -13,7 +13,7 @@ extension UIView { }; }; - return nil + return nil; }; /// Remove all ancestor constraints that are affecting this view instance diff --git a/ios/src_library/Helpers+Utilities/MulticastDelegate.swift b/ios/src_library/Helpers+Utilities/MulticastDelegate.swift index 062f12fe..9f674a7e 100644 --- a/ios/src_library/Helpers+Utilities/MulticastDelegate.swift +++ b/ios/src_library/Helpers+Utilities/MulticastDelegate.swift @@ -8,18 +8,18 @@ import Foundation -class MulticastDelegate { +public class MulticastDelegate { private let delegates: NSHashTable = NSHashTable.weakObjects(); - func add(_ delegate: T) { + public func add(_ delegate: T) { delegates.add(delegate); }; - func remove(_ delegate: T) { + public func remove(_ delegate: T) { self.delegates.remove(delegate); }; - func invoke (_ invocation: @escaping (T) -> Void) { + public func invoke (_ invocation: @escaping (T) -> Void) { for delegate in delegates.allObjects { invocation(delegate) }; diff --git a/ios/src_library/Helpers+Utilities/RNIDictionarySynthesizable.swift b/ios/src_library/Helpers+Utilities/RNIDictionarySynthesizable.swift index 2882f127..3e6ba5f2 100644 --- a/ios/src_library/Helpers+Utilities/RNIDictionarySynthesizable.swift +++ b/ios/src_library/Helpers+Utilities/RNIDictionarySynthesizable.swift @@ -61,7 +61,7 @@ extension RNIDictionarySynthesizable { if let synthesizableDict = value as? (any RNIDictionarySynthesizable) { return(propertyKey, synthesizableDict.synthesizedDictionary); }; - + return (propertyKey, value) }; diff --git a/ios/src_library/Helpers+Utilities/RNIIdentifiable.swift b/ios/src_library/Helpers+Utilities/RNIIdentifiable.swift index e8310d13..f76dbcba 100644 --- a/ios/src_library/Helpers+Utilities/RNIIdentifiable.swift +++ b/ios/src_library/Helpers+Utilities/RNIIdentifiable.swift @@ -45,10 +45,10 @@ fileprivate class Counter { }; public final class RNIObjectIdentifier { - let id: Int; - let uuid = UUID(); + public let id: Int; + public let uuid = UUID(); - init(type: Any) { + public init(type: Any) { self.id = Counter.getAndIncrement(forType: type); }; }; diff --git a/ios/src_library/Helpers+Utilities/RNIViewControllerLifeCycleNotifiable.swift b/ios/src_library/Helpers+Utilities/RNIViewControllerLifeCycleNotifiable.swift index d90d0a47..7cac0132 100644 --- a/ios/src_library/Helpers+Utilities/RNIViewControllerLifeCycleNotifiable.swift +++ b/ios/src_library/Helpers+Utilities/RNIViewControllerLifeCycleNotifiable.swift @@ -7,7 +7,7 @@ import Foundation -protocol RNIViewControllerLifeCycleNotifiable: AnyObject { +public protocol RNIViewControllerLifeCycleNotifiable: AnyObject { func viewDidLoad(sender: UIViewController); @@ -34,35 +34,35 @@ protocol RNIViewControllerLifeCycleNotifiable: AnyObject { }; extension RNIViewControllerLifeCycleNotifiable { - func viewDidLoad(sender: UIViewController) { + public func viewDidLoad(sender: UIViewController) { // no-op }; - func viewDidLayoutSubviews(sender: UIViewController) { + public func viewDidLayoutSubviews(sender: UIViewController) { // no-op }; - func viewWillAppear(sender: UIViewController, animated: Bool) { + public func viewWillAppear(sender: UIViewController, animated: Bool) { // no-op }; - func viewDidAppear(sender: UIViewController, animated: Bool) { + public func viewDidAppear(sender: UIViewController, animated: Bool) { // no-op }; - func viewWillDisappear(sender: UIViewController, animated: Bool) { + public func viewWillDisappear(sender: UIViewController, animated: Bool) { // no-op }; - func viewDidDisappear(sender: UIViewController, animated: Bool) { + public func viewDidDisappear(sender: UIViewController, animated: Bool) { // no-op }; - func willMove(sender: UIViewController, toParent parent: UIViewController?) { + public func willMove(sender: UIViewController, toParent parent: UIViewController?) { // no-op }; - func didMove(sender: UIViewController, toParent parent: UIViewController?) { + public func didMove(sender: UIViewController, toParent parent: UIViewController?) { // no-op }; }; diff --git a/ios/src_library/Helpers+Utilities/WeakElement.swift b/ios/src_library/Helpers+Utilities/WeakElement.swift index 161ec993..a3349f24 100644 --- a/ios/src_library/Helpers+Utilities/WeakElement.swift +++ b/ios/src_library/Helpers+Utilities/WeakElement.swift @@ -8,6 +8,6 @@ import Foundation -class WeakElement { +public class WeakElement { private(set) weak var value: Element?; }; diff --git a/ios/src_library/React Native/RNIModal/RNIModal+Helpers.swift b/ios/src_library/React Native/RNIModal/RNIModal+Helpers.swift index 676d7529..0f4c94dc 100644 --- a/ios/src_library/React Native/RNIModal/RNIModal+Helpers.swift +++ b/ios/src_library/React Native/RNIModal/RNIModal+Helpers.swift @@ -8,7 +8,7 @@ import Foundation extension RNIModalState where Self: RNIIdentifiable { - var modalNativeID: String { + public var modalNativeID: String { self.synthesizedStringID }; }; @@ -16,7 +16,7 @@ extension RNIModalState where Self: RNIIdentifiable { extension RNIModalState where Self: RNIModalPresentation { /// Programmatically check if this instance is presented - var synthesizedIsModalPresented: Bool { + public var synthesizedIsModalPresented: Bool { let listPresentedVC = RNIModalManager.getPresentedViewControllers(for: self.window); @@ -26,7 +26,7 @@ extension RNIModalState where Self: RNIModalPresentation { }; /// Programmatically check if this instance is in focus - var synthesizedIsModalInFocus: Bool { + public var synthesizedIsModalInFocus: Bool { let listPresentedVC = RNIModalManager.getPresentedViewControllers(for: self.window); @@ -41,7 +41,7 @@ extension RNIModalState where Self: RNIModalPresentation { /// * This is based on the view controller hierarchy /// * So parent/child view controller that aren't modals are also counted /// - var synthesizedViewControllerIndex: Int { + public var synthesizedViewControllerIndex: Int { let listPresentedVC = RNIModalManager.getPresentedViewControllers(for: self.window); @@ -54,7 +54,7 @@ extension RNIModalState where Self: RNIModalPresentation { }; /// Programmatically get the "modal index" - var synthesizedModalIndex: Int { + public var synthesizedModalIndex: Int { let listPresentedVC = RNIModalManager.getPresentedViewControllers(for: self.window); @@ -72,7 +72,7 @@ extension RNIModalState where Self: RNIModalPresentation { return -1; }; - var synthesizedCurrentModalIndex: Int { + public var synthesizedCurrentModalIndex: Int { guard let window = self.window else { return -1 }; return RNIModalManagerShared.getCurrentModalIndex(for: window); }; @@ -80,7 +80,7 @@ extension RNIModalState where Self: RNIModalPresentation { extension RNIModalState where Self: RNIModal { - var synthesizedModalData: RNIModalData { + public var synthesizedModalData: RNIModalData { return RNIModalData( modalNativeID: self.modalNativeID, modalIndex: self.modalIndex, @@ -95,7 +95,7 @@ extension RNIModalState where Self: RNIModal { ); }; - var synthesizedModalDataDict: Dictionary { + public var synthesizedModalDataDict: Dictionary { self.synthesizedModalData.synthesizedDictionary; }; }; diff --git a/ios/src_library/React Native/RNIModal/RNIModalData.swift b/ios/src_library/React Native/RNIModal/RNIModalData.swift index 786a77f3..1913bd7a 100644 --- a/ios/src_library/React Native/RNIModal/RNIModalData.swift +++ b/ios/src_library/React Native/RNIModal/RNIModalData.swift @@ -8,19 +8,19 @@ import Foundation public struct RNIModalData: RNIDictionarySynthesizable { - let modalNativeID: String; + public let modalNativeID: String; - let modalIndex: Int; - let currentModalIndex: Int; + public let modalIndex: Int; + public let currentModalIndex: Int; - let isModalPresented: Bool; - let isModalInFocus: Bool; + public let isModalPresented: Bool; + public let isModalInFocus: Bool; - let synthesizedIsModalInFocus: Bool; - let synthesizedIsModalPresented: Bool; + public let synthesizedIsModalInFocus: Bool; + public let synthesizedIsModalPresented: Bool; - let synthesizedModalIndex: Int; - let synthesizedViewControllerIndex: Int; + public let synthesizedModalIndex: Int; + public let synthesizedViewControllerIndex: Int; - let synthesizedWindowID: String?; + public let synthesizedWindowID: String?; }; diff --git a/ios/src_library/React Native/RNIModal/RNIModalEvents.swift b/ios/src_library/React Native/RNIModal/RNIModalEvents.swift index dc8037e5..4f4a6043 100644 --- a/ios/src_library/React Native/RNIModal/RNIModalEvents.swift +++ b/ios/src_library/React Native/RNIModal/RNIModalEvents.swift @@ -19,10 +19,10 @@ public struct RNIModalBaseEventData: RNIDictionarySynthesizable { [\.modalData]; }; - let reactTag: Int; - let modalID: String?; + public let reactTag: Int; + public let modalID: String?; - let modalData: RNIModalData; + public let modalData: RNIModalData; }; public struct RNIOnModalFocusEventData: RNIDictionarySynthesizable { @@ -37,8 +37,8 @@ public struct RNIOnModalFocusEventData: RNIDictionarySynthesizable { [\.modalData]; }; - let modalData: RNIModalBaseEventData; - let senderInfo: RNIModalData; + public let modalData: RNIModalBaseEventData; + public let senderInfo: RNIModalData; - let isInitial: Bool; + public let isInitial: Bool; }; diff --git a/ios/src_library/React Native/RNIModal/RNIModalManager.swift b/ios/src_library/React Native/RNIModal/RNIModalManager.swift index b9f4016e..7018ee86 100644 --- a/ios/src_library/React Native/RNIModal/RNIModalManager.swift +++ b/ios/src_library/React Native/RNIModal/RNIModalManager.swift @@ -58,7 +58,7 @@ public class RNIModalManager { // ------------------------ /// TODO:2023-03-20-21-29-36 - Move to `RNIUtilities` - static func getWindows() -> [UIWindow] { + public static func getWindows() -> [UIWindow] { var windows: [UIWindow] = []; #if swift(>=5.5) @@ -118,7 +118,7 @@ public class RNIModalManager { }; /// TODO:2023-03-20-21-29-36 - Move to `RNIUtilities` - static func getRootViewController( + public static func getRootViewController( for window: UIWindow? = nil ) -> UIViewController? { diff --git a/ios/src_library/React Native/RNIModal/RNIModalPresentationState.swift b/ios/src_library/React Native/RNIModal/RNIModalPresentationState.swift index bf9e3204..cfd4fa38 100644 --- a/ios/src_library/React Native/RNIModal/RNIModalPresentationState.swift +++ b/ios/src_library/React Native/RNIModal/RNIModalPresentationState.swift @@ -28,7 +28,7 @@ public enum RNIModalPresentationState: String { // MARK: - Computed Properties // --------------------------- - var isDismissing: Bool { + public var isDismissing: Bool { switch self { case .DISMISSING_UNKNOWN, .DISMISSING_GESTURE, @@ -40,11 +40,11 @@ public enum RNIModalPresentationState: String { }; }; - var isDismissingKnown: Bool { + public var isDismissingKnown: Bool { self.isDismissing && self != .DISMISSING_UNKNOWN; }; - var isPresenting: Bool { + public var isPresenting: Bool { switch self { case .PRESENTING_PROGRAMMATIC, .PRESENTING_UNKNOWN, @@ -56,7 +56,7 @@ public enum RNIModalPresentationState: String { }; }; - var isNotSpecific: Bool { + public var isNotSpecific: Bool { switch self { case .PRESENTING_UNKNOWN, .DISMISSING_UNKNOWN: @@ -70,19 +70,19 @@ public enum RNIModalPresentationState: String { // MARK: - Computed Properties - Alias // ----------------------------------- - var isDismissViaGestureCancelling: Bool { + public var isDismissViaGestureCancelling: Bool { self == .DISMISS_GESTURE_CANCELLING; }; - var isDismissingViaGesture: Bool { + public var isDismissingViaGesture: Bool { self == .DISMISSING_GESTURE }; - var isPresented: Bool { + public var isPresented: Bool { self == .PRESENTED; }; - var isDismissed: Bool { + public var isDismissed: Bool { self == .DISMISSED; }; }; @@ -92,30 +92,30 @@ public struct RNIModalPresentationStateMachine { // MARK: - Properties // ------------------ - var state: RNIModalPresentationState = .INITIAL; - var statePrev: RNIModalPresentationState = .INITIAL; + private(set) public var state: RNIModalPresentationState = .INITIAL; + private(set) public var statePrev: RNIModalPresentationState = .INITIAL; // MARK: - Properties - Completion Handlers // ---------------------------------------- - var onDismissWillCancel: (() -> Void)?; - var onDismissDidCancel: (() -> Void)?; + public var onDismissWillCancel: (() -> Void)?; + public var onDismissDidCancel: (() -> Void)?; // MARK: - Computed Properties // --------------------------- - var isPresented: Bool { + public var isPresented: Bool { self.state == .PRESENTED; }; - var wasDismissViaGestureCancelled: Bool { + public var wasDismissViaGestureCancelled: Bool { self.statePrev.isDismissViaGestureCancelling }; // MARK: - Functions // ----------------- - mutating func set(state nextState: RNIModalPresentationState){ + public mutating func set(state nextState: RNIModalPresentationState){ let prevState = self.state; self.statePrev = prevState; @@ -131,7 +131,7 @@ public struct RNIModalPresentationStateMachine { /// Do not over-write specific/"known state", with non-specific/"unknown /// state", e.g. /// - /// * ✅: `PRESENTING_PROGRAMMATIC` -> `PRESENTING_UNKNOWN` + /// * ✅: `PRESENTING_UNKNOWN` -> `PRESENTING_PROGRAMMATIC` /// * ❌: `DISMISSING_GESTURE` -> `DISMISSING_UNKNOWN` return; diff --git a/ios/src_library/React Native/RNIModalView/RNIModalView.swift b/ios/src_library/React Native/RNIModalView/RNIModalView.swift index 43fa1f78..eadd23ff 100644 --- a/ios/src_library/React Native/RNIModalView/RNIModalView.swift +++ b/ios/src_library/React Native/RNIModalView/RNIModalView.swift @@ -8,10 +8,10 @@ import Foundation -class RNIModalView: UIView, RNIIdentifiable, RNIModalFocusNotifying, - RNIModalState, RNIModalPresentation { +public class RNIModalView: UIView, RNIIdentifiable, RNIModalFocusNotifying, + RNIModalState, RNIModalPresentation { - typealias CompletionHandler = (_ isSuccess: Bool, _ error: RNIModalViewError?) -> Void; + public typealias CompletionHandler = (_ isSuccess: Bool, _ error: RNIModalViewError?) -> Void; enum NativeIDKey: String { case modalViewContent; @@ -20,7 +20,7 @@ class RNIModalView: UIView, RNIIdentifiable, RNIModalFocusNotifying, // MARK: - Properties - RNIIdentifiable // ------------------------------------ - static var synthesizedIdPrefix: String = "modal-id-"; + public static var synthesizedIdPrefix: String = "modal-id-"; // MARK: - Properties // ------------------ @@ -28,23 +28,23 @@ class RNIModalView: UIView, RNIIdentifiable, RNIModalFocusNotifying, weak var bridge: RCTBridge?; var modalContentWrapper: RNIWrapperView?; - var modalVC: RNIModalViewController?; + public var modalVC: RNIModalViewController?; // MARK: - Properties - RNIModalFocusNotifying // ------------------------------------------- - weak var modalFocusDelegate: RNIModalFocusNotifiable!; + public weak var modalFocusDelegate: RNIModalFocusNotifiable!; // MARK: - Properties - RNIModalIdentity // ------------------------------------- - var modalIndex: Int!; - var modalIndexPrev: Int!; + public var modalIndex: Int!; + public var modalIndexPrev: Int!; // MARK: - Properties - RNIModalState // ---------------------------------- - lazy var modalState = RNIModalPresentationStateMachine( + public lazy var modalState = RNIModalPresentationStateMachine( onDismissWillCancel: { [weak self] in // no-op - TBA }, @@ -53,16 +53,16 @@ class RNIModalView: UIView, RNIIdentifiable, RNIModalFocusNotifying, } ); - var isModalInFocus: Bool = false; + public var isModalInFocus: Bool = false; // MARK: - Properties - RNIModalPresentation // ----------------------------------------- - var modalViewController: UIViewController? { + public var modalViewController: UIViewController? { self.modalVC; }; - weak var presentingViewController: UIViewController?; + public weak var presentingViewController: UIViewController?; // MARK: - Properties: React Props - Events // ---------------------------------------- @@ -161,7 +161,7 @@ class RNIModalView: UIView, RNIIdentifiable, RNIModalFocusNotifying, // MARK: - Properties: Synthesized From Props // ------------------------------------------ - var synthesizedModalPresentationStyle: UIModalPresentationStyle { + public var synthesizedModalPresentationStyle: UIModalPresentationStyle { let defaultStyle: UIModalPresentationStyle = { guard #available(iOS 13.0, *) else { return .overFullScreen }; return .automatic; @@ -205,7 +205,7 @@ class RNIModalView: UIView, RNIIdentifiable, RNIModalFocusNotifying, }; }; - var synthesizedModalTransitionStyle: UIModalTransitionStyle { + public var synthesizedModalTransitionStyle: UIModalTransitionStyle { let defaultStyle: UIModalTransitionStyle = .coverVertical ; // TODO:2023-03-22-13-18-14 - Refactor: Move `fromString` to enum init @@ -227,7 +227,7 @@ class RNIModalView: UIView, RNIIdentifiable, RNIModalFocusNotifying, return style; }; - var synthesizedModalBGBlurEffectStyle: UIBlurEffect.Style { + public var synthesizedModalBGBlurEffectStyle: UIBlurEffect.Style { // Provide default value let defaultStyle: UIBlurEffect.Style = { guard #available(iOS 13.0, *) else { return .light }; @@ -255,7 +255,7 @@ class RNIModalView: UIView, RNIIdentifiable, RNIModalFocusNotifying, // MARK: - Properties: Synthesized // ------------------------------- - var synthesizedBaseEventData: RNIModalBaseEventData { + public var synthesizedBaseEventData: RNIModalBaseEventData { RNIModalBaseEventData( reactTag: self.reactTag.intValue, modalID: self.modalID as? String, @@ -281,14 +281,14 @@ class RNIModalView: UIView, RNIIdentifiable, RNIModalFocusNotifying, // MARK: - UIKit Lifecycle // ----------------------- - override func didMoveToWindow() { + public override func didMoveToWindow() { super.didMoveToWindow(); if self.presentViaMount { self.dismissModal(); }; }; - override func didMoveToSuperview() { + public override func didMoveToSuperview() { super.didMoveToSuperview(); if self.presentViaMount { self.presentModal(); @@ -298,7 +298,7 @@ class RNIModalView: UIView, RNIIdentifiable, RNIModalFocusNotifying, // MARK: - React-Native Lifecycle // ------------------------------ - override func insertReactSubview(_ subview: UIView!, at atIndex: Int) { + public override func insertReactSubview(_ subview: UIView!, at atIndex: Int) { super.insertReactSubview(subview, at: atIndex); guard let wrapperView = subview as? RNIWrapperView, @@ -328,7 +328,7 @@ class RNIModalView: UIView, RNIIdentifiable, RNIModalFocusNotifying, wrapperView.isMovingToParent = false; }; - override func removeReactSubview(_ subview: UIView!) { + public override func removeReactSubview(_ subview: UIView!) { super.removeReactSubview(subview); }; @@ -659,7 +659,7 @@ extension RNIModalView: UIAdaptivePresentationControllerDelegate { /// * 3 - `viewWillAppear` /// * 4 - `viewDidAppear` /// - func presentationControllerWillDismiss(_ presentationController: UIPresentationController) { + public func presentationControllerWillDismiss(_ presentationController: UIPresentationController) { self.modalState.set(state: .DISMISSING_GESTURE); #if DEBUG @@ -672,7 +672,7 @@ extension RNIModalView: UIAdaptivePresentationControllerDelegate { #endif }; - func presentationControllerDidDismiss(_ presentationController: UIPresentationController) { + public func presentationControllerDidDismiss(_ presentationController: UIPresentationController) { self.modalFocusDelegate.onModalDidBlurNotification(sender: self); #if DEBUG @@ -688,7 +688,7 @@ extension RNIModalView: UIAdaptivePresentationControllerDelegate { /// No other "view controller"-related lifecycle method was trigger in /// response to this event being invoked. /// - func presentationControllerDidAttemptToDismiss(_ presentationController: UIPresentationController) { + public func presentationControllerDidAttemptToDismiss(_ presentationController: UIPresentationController) { self.onModalAttemptDismiss?( self.synthesizedBaseEventData.synthesizedDictionary ); @@ -709,7 +709,7 @@ extension RNIModalView: UIAdaptivePresentationControllerDelegate { extension RNIModalView: RNIModalRequestable { - func requestModalToShow( + public func requestModalToShow( sender:any RNIModal, onRequestApprovedBlock: () -> Void, onRequestDeniedBlock: (String) -> Void @@ -718,7 +718,7 @@ extension RNIModalView: RNIModalRequestable { /// No-op - TBA }; - func requestModalToHide( + public func requestModalToHide( sender: any RNIModal, onRequestApprovedBlock: () -> Void, onRequestDeniedBlock: (String) -> Void @@ -730,14 +730,14 @@ extension RNIModalView: RNIModalRequestable { extension RNIModalView: RNIViewControllerLifeCycleNotifiable { - func viewWillAppear(sender: UIViewController, animated: Bool) { + public func viewWillAppear(sender: UIViewController, animated: Bool) { guard sender.isBeingPresented else { return }; self.modalState.set(state: .PRESENTING_UNKNOWN); self.modalFocusDelegate.onModalWillFocusNotification(sender: self); }; - func viewDidAppear(sender: UIViewController, animated: Bool) { + public func viewDidAppear(sender: UIViewController, animated: Bool) { guard sender.isBeingPresented else { return }; self.modalState.set(state: .PRESENTED); @@ -750,7 +750,7 @@ extension RNIModalView: RNIViewControllerLifeCycleNotifiable { }; }; - func viewWillDisappear(sender: UIViewController, animated: Bool) { + public func viewWillDisappear(sender: UIViewController, animated: Bool) { guard sender.isBeingDismissed else { return }; self.modalState.set(state: .DISMISSING_UNKNOWN); @@ -763,7 +763,7 @@ extension RNIModalView: RNIViewControllerLifeCycleNotifiable { }; }; - func viewDidDisappear(sender: UIViewController, animated: Bool) { + public func viewDidDisappear(sender: UIViewController, animated: Bool) { guard sender.isBeingDismissed else { return }; self.modalState.set(state: .DISMISSED); @@ -860,11 +860,11 @@ extension RNIModalView: RNIViewControllerLifeCycleNotifiable { /// extension RNIModalView: RNIModalFocusNotifiable { - func onModalWillFocusNotification(sender: any RNIModal) { + public func onModalWillFocusNotification(sender: any RNIModal) { /// No-op - TBA }; - func onModalDidFocusNotification(sender: any RNIModal) { + public func onModalDidFocusNotification(sender: any RNIModal) { let eventData = RNIOnModalFocusEventData( modalData: self.synthesizedBaseEventData, @@ -887,11 +887,11 @@ extension RNIModalView: RNIModalFocusNotifiable { ); }; - func onModalWillBlurNotification(sender: any RNIModal) { + public func onModalWillBlurNotification(sender: any RNIModal) { /// No-op - TBA }; - func onModalDidBlurNotification(sender: any RNIModal) { + public func onModalDidBlurNotification(sender: any RNIModal) { let eventData = RNIOnModalFocusEventData( modalData: self.synthesizedBaseEventData, senderInfo: sender.synthesizedModalData, diff --git a/ios/src_library/React Native/RNIModalView/RNIModalViewController.swift b/ios/src_library/React Native/RNIModalView/RNIModalViewController.swift index 2cc7ecce..15ddb1ed 100644 --- a/ios/src_library/React Native/RNIModalView/RNIModalViewController.swift +++ b/ios/src_library/React Native/RNIModalView/RNIModalViewController.swift @@ -8,12 +8,12 @@ import Foundation -class RNIModalViewController: UIViewController { +public class RNIModalViewController: UIViewController { // MARK: - Properties // ------------------ - var prevBounds: CGRect?; + private(set) public var prevBounds: CGRect?; weak var lifecycleDelegate: RNIViewControllerLifeCycleNotifiable?; @@ -74,7 +74,7 @@ class RNIModalViewController: UIViewController { // MARK: - View Controller Lifecycle // --------------------------------- - override func viewDidLoad() { + public override func viewDidLoad() { super.viewDidLoad(); self.view = { @@ -95,7 +95,7 @@ class RNIModalViewController: UIViewController { self.lifecycleDelegate?.viewDidLoad(sender: self); }; - override func viewDidLayoutSubviews(){ + public override func viewDidLayoutSubviews(){ super.viewDidLayoutSubviews(); let didChangeBounds: Bool = { @@ -124,7 +124,7 @@ class RNIModalViewController: UIViewController { self.lifecycleDelegate?.viewDidLayoutSubviews(sender: self); }; - override func viewWillAppear(_ animated: Bool) { + public override func viewWillAppear(_ animated: Bool) { super.viewWillAppear(animated); self.lifecycleDelegate? @@ -140,7 +140,7 @@ class RNIModalViewController: UIViewController { #endif }; - override func viewDidAppear(_ animated: Bool) { + public override func viewDidAppear(_ animated: Bool) { super.viewDidAppear(animated); self.lifecycleDelegate? @@ -156,7 +156,7 @@ class RNIModalViewController: UIViewController { #endif }; - override func viewWillDisappear(_ animated: Bool) { + public override func viewWillDisappear(_ animated: Bool) { super.viewWillDisappear(animated); self.lifecycleDelegate? @@ -174,7 +174,7 @@ class RNIModalViewController: UIViewController { #endif }; - override func viewDidDisappear(_ animated: Bool) { + public override func viewDidDisappear(_ animated: Bool) { super.viewDidDisappear(animated); self.lifecycleDelegate? @@ -190,7 +190,7 @@ class RNIModalViewController: UIViewController { #endif }; - override func willMove(toParent parent: UIViewController?) { + public override func willMove(toParent parent: UIViewController?) { super.willMove(toParent: parent); self.lifecycleDelegate?.willMove(sender: self, toParent: parent); @@ -206,7 +206,7 @@ class RNIModalViewController: UIViewController { #endif }; - override func didMove(toParent parent: UIViewController?) { + public override func didMove(toParent parent: UIViewController?) { super.didMove(toParent: parent); self.lifecycleDelegate?.didMove(sender: self, toParent: parent); diff --git a/ios/src_library/React Native/RNIWeak/RNIWeakArray.swift b/ios/src_library/React Native/RNIWeak/RNIWeakArray.swift index 46317192..9e200a7a 100644 --- a/ios/src_library/React Native/RNIWeak/RNIWeakArray.swift +++ b/ios/src_library/React Native/RNIWeak/RNIWeakArray.swift @@ -25,13 +25,13 @@ public class RNIWeakArray { return purgedArray; }; - init(initialItems: [T] = []){ + public init(initialItems: [T] = []){ self.rawArray = initialItems.compactMap { RNIWeakRef(with: $0) }; }; - func get(index: Int) -> T? { + public func get(index: Int) -> T? { guard self.rawArray.count < index else { return nil }; @@ -44,7 +44,7 @@ public class RNIWeakArray { return ref; }; - func set(index: Int, element: T) { + public func set(index: Int, element: T) { guard self.rawArray.count < index else { return; }; @@ -53,7 +53,7 @@ public class RNIWeakArray { }; - func append(element: T){ + public func append(element: T){ self.rawArray.append( RNIWeakRef(with: element) );