0

我是 iOS 开发的新手,想知道如何在调用 test2() 之前等待 Apollo iOS 客户端代码完成,示例代码如下:

func test() {
    Network.shared.apollo.perform(mutation: AnonymousAccessTokenMutation()) { result in
        guard let data = try? result.get().data else { return }
        print(data.anonymousAccessToken.anonymousAccessToken)
        Constants.User.anonymousAccessToken = "Bearer " + data.anonymousAccessToken.anonymousAccessToken!
    }
    // wait for above code to complete before resuming
    test2()
}
4

0 回答 0