我有一個(gè)協(xié)議RequestType,它具有如下的relatedType模型。public protocol RequestType: class { associatedtype Model var path: String { get set }}public extension RequestType { public func executeRequest(completionHandler: Result<Model, NSError> -> Void) { request.response(rootKeyPath: rootKeyPath) { [weak self] (response: Response<Model, NSError>) -> Void in completionHandler(response.result) guard let weakSelf = self else { return } if weakSelf.logging { debugPrint(response) } } }}現(xiàn)在,我試圖對(duì)所有失敗的請(qǐng)求進(jìn)行排隊(duì)。public class RequestEventuallyQueue { static let requestEventuallyQueue = RequestEventuallyQueue() let queue = [RequestType]()}但是我在線上看到錯(cuò)誤,let queue = [RequestType]()因?yàn)镻rotocol RequestType具有Self或associatedType要求,因此只能用作通用約束。
- 2 回答
- 0 關(guān)注
- 749 瀏覽
添加回答
舉報(bào)
0/150
提交
取消
