文章来源:淘论文网   发布者: 毕业设计   浏览量: 32



还可以点击去查询以下关键词:
[Parsin]    [定制]    [Codable]    [JSON Parsin定制g With Codable]   

项目介绍:

AlamofireCodable: An extension to Alamofire which automatically converts JSON response data into swift objects using Codable.
This project is heavily inspired by the popular AlamofireObjectMapper.

Installation

AlamofireCodable can be added to your project using CocoaPods by adding the following line to your Podfile:

pod 'AlamofireCodable'Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Requirements

Xcode 9+ , Swift 4+

Usage

Given a URL which returns weather data in the following form:

{ 'data':{ 'location':'Toronto, Canada', 'three_day_forecast':[ { 'conditions':'Partly cloudy', 'day':'Monday', 'temperature':20 }, { 'conditions':'Showers', 'day':'Tuesday', 'temperature':22 }, { 'conditions':'Sunny', 'day':'Wednesday', 'temperature':28 } ] } }

You can use the extension as the follows:

import AlamofireCodable let form = WeatherForm() Alamofire.request( form.url, method: HTTPMethod.get, parameters: form.parameters(), encoding: form.encoding(), headers: form.headers() ) .responseObject(keyPath: 'data',completionHandler: { (response: DataResponse<Weather>) in switch response.result { case .success(let object): debugPrint('

开题报告开题报告

这里还有:


还可以点击去查询:
[Parsin]    [定制]    [Codable]    [JSON Parsin定制g With Codable]   

请扫码加微信 微信号:sj52abcd


下载地址: http://www.taolw.com/down/3679.docx
  • 上一篇:iOS列表选择弹框
  • 下一篇:侧边导航 SideNavigation