iOS/코드조각

[iOS, Swift] Alamofire responseDecodable 사용하기

검은참깨두유vm 2022. 7. 12. 19:05
반응형

iOS 15.5, Xcode 13.31, Swift 5, UIKit 환경에서 진행했습니다.

 

let model: Model

AF.request(url, method: .post).responseDecodable(of: Model.self) { response in
    guard let value = response.value else { return }
    self.model = value
    print(self.model)
}

 

반응형