| 1 |
//
|
|
| 2 |
// RouteComposer
|
|
| 3 |
// PreparableEntity.swift
|
|
| 4 |
// https://github.com/ekazaev/route-composer
|
|
| 5 |
//
|
|
| 6 |
// Created by Eugene Kazaev in 2018-2022.
|
|
| 7 |
// Distributed under the MIT license.
|
|
| 8 |
//
|
|
| 9 |
// Become a sponsor:
|
|
| 10 |
// https://github.com/sponsors/ekazaev
|
|
| 11 |
//
|
|
| 12 |
|
|
| 13 |
import Foundation
|
|
| 14 |
|
|
| 15 |
protocol PreparableEntity {
|
|
| 16 |
|
|
| 17 |
var isPrepared: Bool { get }
|
|
| 18 |
|
|
| 19 |
}
|
|
| 20 |
|
|
| 21 |
extension PreparableEntity {
|
|
| 22 |
|
|
| 23 |
func assertIfNotPrepared() {
|
622x |
| 24 |
if !isPrepared {
|
622x |
| 25 |
assertionFailure("Internal inconsistency: prepare(with:) method has never been " +
|
! |
| 26 |
"called for \(String(describing: self)).")
|
! |
| 27 |
}
|
622x |
| 28 |
}
|
622x |
| 29 |
|
|
| 30 |
}
|
|