Untitled

 avatar
unknown
swift
2 years ago
521 B
11
Indexable
import Foundation

protocol Foosyncable: AnyObject {
    func request()
}

protocol Fooasyncable: AnyObject {
    func request() async
}

protocol Fooable: Foosyncable, Fooasyncable {}

class Foo: Fooable {
    func request() {
        print("request")
    }

    func request() async {
        print("request async")
    }
}

class Fooooooo {
    let f: Fooable
    init() {
        f = Foo()
    }

    func boo() async throws {
        await f.request()
    }
}

let f = Fooooooo()
Task {
    try await f.boo()
}





Editor is loading...