2018-05-23 19:49:10 +00:00
|
|
|
//
|
|
|
|
// Coordinator.swift
|
2018-05-24 18:13:21 +00:00
|
|
|
// WireGuard
|
2018-05-23 19:49:10 +00:00
|
|
|
//
|
|
|
|
// Created by Jeroen Leenarts on 23-05-18.
|
2018-07-15 09:55:41 +00:00
|
|
|
// Copyright © 2018 Jason A. Donenfeld <Jason@zx2c4.com>. All rights reserved.
|
2018-05-23 19:49:10 +00:00
|
|
|
//
|
|
|
|
|
|
|
|
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 }
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|