From d647dc9d18d08e27263946a63ee759ef8bd4ecd3 Mon Sep 17 00:00:00 2001 From: Sumanth Nadigadda Date: Thu, 23 Feb 2023 20:54:35 +0530 Subject: [PATCH] shouldFinishProcessingLoad Behavior flow - Minor changes --- MVMCoreUI/BaseControllers/ViewController.swift | 6 ++---- .../Behaviors/Protocols/PageBehaviorHandlerProtocol.swift | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/MVMCoreUI/BaseControllers/ViewController.swift b/MVMCoreUI/BaseControllers/ViewController.swift index dddb918e..fe7eee30 100644 --- a/MVMCoreUI/BaseControllers/ViewController.swift +++ b/MVMCoreUI/BaseControllers/ViewController.swift @@ -148,12 +148,10 @@ import MVMCore ///Check with behavior if it can continue do{ - let conditionSatisfied = try executeThrowingBehaviors {(behavior: PageMoleculeTransformationBehavior) in + let allFinishedProcessingLoad = try executeThrowingBehaviors {(behavior: PageMoleculeTransformationBehavior) in return try behavior.shouldFinishProcessingLoad(loadObject) } - if conditionSatisfied == false { - return conditionSatisfied - } + guard allFinishedProcessingLoad else { return false } } catch let behaviorError { if let errorObject = MVMCoreErrorObject.createErrorObject(for: behaviorError, location: MVMCoreLoadHandler.sharedGlobal()?.errorLocation(forRequest: loadObject)) { error.pointee = errorObject diff --git a/MVMCoreUI/Behaviors/Protocols/PageBehaviorHandlerProtocol.swift b/MVMCoreUI/Behaviors/Protocols/PageBehaviorHandlerProtocol.swift index b0d49b69..9e5c6a6d 100644 --- a/MVMCoreUI/Behaviors/Protocols/PageBehaviorHandlerProtocol.swift +++ b/MVMCoreUI/Behaviors/Protocols/PageBehaviorHandlerProtocol.swift @@ -46,6 +46,6 @@ public extension PageBehaviorHandlerProtocol { } func executeThrowingBehaviors(_ behaviourBlock: (_ behavior: T) throws -> Bool) throws -> Bool { - return try behaviors?.compactMap({$0 as? T}).allSatisfy({ return try behaviourBlock($0) }) ?? false + return try behaviors?.compactMap({$0 as? T}).allSatisfy({ return try behaviourBlock($0) }) ?? true } }