wireguard-apple/WireGuard/Coordinators/Coordinator.swift
Jeroen Leenarts 484bef1777 Clean up old school headers.
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-09-16 21:17:54 +02:00

31 lines
746 B
Swift

//
// Copyright © 2018 WireGuard LLC. All rights reserved.
//
import Foundation
/// The Coordinator protocol
public protocol Coordinator: class {
/// Starts the coordinator
func start()
/// The array containing any child Coordinators
var childCoordinators: [Coordinator] { get set }
}
public extension Coordinator {
/// Add a child coordinator to the parent
public func addChildCoordinator(_ childCoordinator: Coordinator) {
self.childCoordinators.append(childCoordinator)
}
/// Remove a child coordinator from the parent
public func removeChildCoordinator(_ childCoordinator: Coordinator) {
self.childCoordinators = self.childCoordinators.filter { $0 !== childCoordinator }
}
}