Протокол может использоваться только в качестве общего ограничения, поскольку у него есть требования Self или relatedType.

У меня есть протокол RequestType, и он имеет ModelType, как показано ниже.

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) }
        }
    }

}

Сейчас я пытаюсь сделать очередь всех неудачных запросов.

public class RequestEventuallyQueue {

    static let requestEventuallyQueue = RequestEventuallyQueue()
    let queue = [RequestType]()

}

Но я получаю ошибку на линииlet queue = [RequestType]() этот Protocol RequestType может использоваться только в качестве общего ограничения, поскольку у него есть требования Self или relatedType.

Ответы на вопрос(1)

Ваш ответ на вопрос