move function behavior for scoping

This commit is contained in:
Scott Pfeil 2022-05-02 17:52:15 -04:00
parent 48388343ef
commit 6762082b7c

View File

@ -34,4 +34,9 @@ public extension PageBehaviorHandlerProtocol {
}
self.behaviors = behaviors.count > 0 ? behaviors : nil
}
/// Executes all behaviors of type.
public func executeBehaviors<T>(_ behaviorBlock: (_ behavior: T) -> Void) {
behaviors?.compactMap { $0 as? T }.forEach { behaviorBlock($0) }
}
}