Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import UIKit
- @UIApplicationMain
- class AppDelegate: UIResponder, UIApplicationDelegate {
- var window: UIWindow?
- func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
- print(process(MyFoo()))
- return true
- }
- }
- struct MyFoo: Foo {
- var body: some Foo {
- return Bar()
- }
- }
- public func process<Out: Foo>(_ foo: Out) -> String {
- print("hi")
- return process(foo.body)
- }
- public protocol Foo {
- associatedtype Body: Foo
- var body: Body { get }
- }
- extension Never: Foo {
- public var body: Never {
- fatalError()
- }
- }
- struct Bar: Foo {
- typealias Body = Never
- public var body: Self.Body {
- fatalError()
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement