will show and will hide

This commit is contained in:
Kyle Matthew Hedden 2022-03-10 21:43:54 -05:00
parent 157c5c574b
commit 926ee41277
2 changed files with 26 additions and 0 deletions

View File

@ -385,6 +385,14 @@ import UIKit
}
}
open override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
executeBehaviors { [weak self] (behavior: PageVisibilityBehavior) in
behavior.willShowPage(self?.delegateObjectIVar)
}
}
open override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
@ -393,6 +401,14 @@ import UIKit
}
}
open override func viewWillDisappear(_ animated: Bool) {
super.viewWillDisappear(animated)
executeBehaviors { [weak self] (behavior: PageVisibilityBehavior) in
behavior.willHidePage(self?.delegateObjectIVar)
}
}
open override func viewDidDisappear(_ animated: Bool) {
super.viewDidDisappear(animated)

View File

@ -33,10 +33,20 @@ public extension PageMoleculeTransformationBehavior {
public protocol PageVisibilityBehavior: PageBehaviorProtocol {
func willShowPage(_ delegateObject: MVMCoreUIDelegateObject?)
func onPageShown(_ delegateObject: MVMCoreUIDelegateObject?)
func willHidePage(_ delegateObject: MVMCoreUIDelegateObject?)
func onPageHidden(_ delegateObject: MVMCoreUIDelegateObject?)
}
public extension PageVisibilityBehavior {
// All optional.
func willShowPage(_ delegateObject: MVMCoreUIDelegateObject?) {}
func onPageShown(_ delegateObject: MVMCoreUIDelegateObject?) {}
func willHidePage(_ delegateObject: MVMCoreUIDelegateObject?) {}
func onPageHidden(_ delegateObject: MVMCoreUIDelegateObject?) {}
}
public protocol PageScrolledBehavior: PageBehaviorProtocol {
func pageScrolled(scrollView: UIScrollView, _ delegateObject: MVMCoreUIDelegateObject?)