Merge branch 'feature/hab_enhancements' into 'develop'
behavior transcendence See merge request BPHV_MIPS/mvm_core_ui!882
This commit is contained in:
commit
c3db764db7
@ -42,7 +42,7 @@ public extension TemplateProtocol {
|
||||
behaviorHandlerModel.traverseAndAddRequiredBehaviors()
|
||||
behaviorHandler.createBehaviors(for: behaviorHandlerModel, delegateObject: delegateObject)
|
||||
if let viewController = self as? UIViewController {
|
||||
MVMCoreUISession.sharedGlobal()?.applyGlobalBehaviors(to: (viewController))
|
||||
MVMCoreUISession.sharedGlobal()?.applyGlobalBehaviors(to: viewController)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -14,12 +14,17 @@ public protocol PageBehaviorHandlerProtocol {
|
||||
public extension PageBehaviorHandlerProtocol {
|
||||
/// Creates the behaviors and sets the variable.
|
||||
mutating func createBehaviors(for model: PageBehaviorHandlerModelProtocol, delegateObject: MVMCoreUIDelegateObject?) {
|
||||
guard let behaviorModels = model.behaviors else {
|
||||
|
||||
behaviors = behaviors?.filter { $0.transcendsPageUpdates }
|
||||
if behaviors?.isEmpty ?? false {
|
||||
behaviors = nil
|
||||
}
|
||||
|
||||
guard let behaviorModels = model.behaviors else {
|
||||
return
|
||||
}
|
||||
|
||||
var behaviors: [PageBehaviorProtocol] = []
|
||||
var behaviors: [PageBehaviorProtocol] = behaviors ?? []
|
||||
|
||||
for behaviorModel in behaviorModels {
|
||||
do {
|
||||
|
||||
@ -9,10 +9,17 @@
|
||||
|
||||
public protocol PageBehaviorProtocol: ModelHandlerProtocol {
|
||||
|
||||
/// Should the behavior persist regardless of page behavior model updates.
|
||||
var transcendsPageUpdates: Bool { get }
|
||||
|
||||
/// Initializes the behavior with the model
|
||||
init(model: PageBehaviorModelProtocol, delegateObject: MVMCoreUIDelegateObject?)
|
||||
}
|
||||
|
||||
public extension PageBehaviorProtocol {
|
||||
var transcendsPageUpdates: Bool { return false }
|
||||
}
|
||||
|
||||
/**
|
||||
Behavior conforming protocols. Behaviors will conform to one or more of these protocols to receive page lifecycle events that pertain to them.
|
||||
*/
|
||||
|
||||
Loading…
Reference in New Issue
Block a user