В Alamofire, я считаю, есть перечисление:Как я могу инициализировать этот вид Enum, который содержит свойства и никакого конструктора в Swift?
public enum Result<Value, Error : ErrorType> {
case Success(Value)
case Failure(Error)
/// Returns `true` if the result is a success, `false` otherwise.
public var isSuccess: Bool { get }
/// Returns `true` if the result is a failure, `false` otherwise.
public var isFailure: Bool { get }
/// Returns the associated value if the result is a success, `nil` otherwise.
public var value: Value? { get }
/// Returns the associated error value if the result is a failure, `nil` otherwise.
public var error: Error? { get }
}
В STRUCT ответ, мне нужно будет дать его конструктору результат.
public init(request: NSURLRequest?, response: NSHTTPURLResponse?, data: NSData?, result: Alamofire.Result<Value, Error>)
Но, к сожалению, я обнаружил, что внутри struct Response нет init, и у каждого свойства есть только геттер. Итак, как я могу запустить Response и использовать его для init struct Response?
Да! Инициировать перечисление с его примером, конечно. Я просто немного смутился, потому что свойства перечислены ... Большое спасибо – Desmond