Skip to content

ysjjchh/apimodel

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

apimodel

RESTful api client model for swift

example:

class UserInfo : Codable {
    var userId: String?
    var truename: String?
    var token: String?
}
class LoginReq: Request {
    typealias Response = BaseResponse<UserInfo>
    
    internal var path: String = "sign-in"
    internal var method: HTTPMethod = .post
    
    var mobile: String!
    var authCode: String!
    
    var parameter: [String : Any] {
        get {
            return ["mobile":mobile, "authCode":authCode]
        }
    }
    
    init(mobile: String, authCode: String) {
        self.mobile = mobile
        self.authCode = authCode
    }
}
lazy var apiModel: ApiModel = ApiModel()
let req = LoginReq(mobile: "", authCode: "")
apiModel.send(req) {(resp) in
                if resp.isSuccess {

                } else {
      
                }
            }
        }

About

RESTful api client model for swift

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages