Untitled

mail@pastecode.io avatar
unknown
swift
a year ago
521 B
8
Indexable
Never
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()
}