From 6cbdee4c1127fb44e76864b15caf996b941eaa39 Mon Sep 17 00:00:00 2001 From: Dominic Go Date: Fri, 27 Sep 2024 03:17:21 +0800 Subject: [PATCH] =?UTF-8?q?=E2=AD=90=EF=B8=8F=20Impl:=20`ViewControllerLif?= =?UTF-8?q?ecycleNotifiable`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ViewControllerLifecycleNotifiable.swift | 104 ++++++++++++++++++ 1 file changed, 104 insertions(+) create mode 100644 ios/Temp/ViewControllerLifecycleNotifiable.swift diff --git a/ios/Temp/ViewControllerLifecycleNotifiable.swift b/ios/Temp/ViewControllerLifecycleNotifiable.swift new file mode 100644 index 00000000..8feacab5 --- /dev/null +++ b/ios/Temp/ViewControllerLifecycleNotifiable.swift @@ -0,0 +1,104 @@ +// +// ViewControllerLifecycleNotifiable.swift +// react-native-ios-modal +// +// Created by Dominic Go on 9/27/24. +// + +import UIKit + + +public protocol ViewControllerLifecycleNotifiable: AnyObject { + + func notifyOnViewDidLoad(sender: UIViewController); + + func notifyOnViewWillAppear( + sender: UIViewController, + isAnimated: Bool + ); + + func notifyOnViewIsAppearing( + sender: UIViewController, + isAnimated: Bool + ); + + func notifyOnViewDidAppear( + sender: UIViewController, + isAnimated: Bool + ); + + func notifyOnViewWillDisappear( + sender: UIViewController, + isAnimated: Bool + ); + + func notifyOnViewDidDisappear( + sender: UIViewController, + isAnimated: Bool + ); + + func notifyOnViewWillLayoutSubviews( + sender: UIViewController + ); + + func notifyOnViewDidLayoutSubviews( + sender: UIViewController + ); +}; + +// MARK: - ViewControllerLifecycleNotifiable+Default +// ------------------------------------------------- + +public extension ViewControllerLifecycleNotifiable { + + func notifyOnViewDidLoad(sender: UIViewController) { + // no-op + }; + + func notifyOnViewWillAppear( + sender: UIViewController, + isAnimated: Bool + ) { + // no-op + }; + + func notifyOnViewIsAppearing( + sender: UIViewController, + isAnimated: Bool + ) { + // no-op + }; + + func notifyOnViewDidAppear( + sender: UIViewController, + isAnimated: Bool + ) { + // no-op + }; + + func notifyOnViewWillDisappear( + sender: UIViewController, + isAnimated: Bool + ) { + // no-op + }; + + func notifyOnViewDidDisappear( + sender: UIViewController, + isAnimated: Bool + ) { + // no-op + }; + + func notifyOnViewWillLayoutSubviews( + sender: UIViewController + ) { + // no-op + }; + + func notifyOnViewDidLayoutSubviews( + sender: UIViewController + ) { + // no-op + }; +};