mirror of
https://github.com/passepartoutvpn/wireguard-apple.git
synced 2025-01-07 09:12:37 +00:00
484bef1777
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
24 lines
564 B
Swift
24 lines
564 B
Swift
//
|
|
// Copyright © 2018 WireGuard LLC. All rights reserved.
|
|
//
|
|
|
|
import Foundation
|
|
import UIKit
|
|
|
|
public protocol Identifyable: class {
|
|
static var identifier: String { get }
|
|
}
|
|
|
|
public extension Identifyable {
|
|
static var identifier: String {
|
|
return String(describing: Self.self)
|
|
}
|
|
}
|
|
|
|
extension UIStoryboard {
|
|
|
|
public func instantiateViewController<T: Identifyable>(type: T.Type) -> T where T: UIViewController {
|
|
return self.instantiateViewController(withIdentifier: type.identifier) as! T // swiftlint:disable:this force_cast
|
|
}
|
|
}
|