AlamofireKit 1.0.1

AlamofireKit 1.0.1

Rz Rasel维护。



  • Md. Rashed - Uz - Zaman (Rz Rasel)

AlamofireKit

Rz Rasel CI Status Version License Platform GitHub release Swift Xcode

AlamofireKit 最新版本 - 0.1.1.01 和下一个版本 - 0.1.1.02

示例

要运行示例项目,请先克隆仓库,然后从 Example 目录中运行 `pod install`。

要求

  • iOS 11
  • Swift 5
  • Xcode 12

安装

AlamofireKit 可以通过 CocoaPods 获取。要安装它,只需将以下行添加到您的 Podfile 中

pod 'AlamofireKit'

或者

pod 'AlamofireKit', '~> 0.1'

项目集成

import AlamofireKit

HTTP 请求

AlamofireKit.request({ (success, data, error) in
    if success {
        guard let data = data else {
            return
        }
        self.apiModel = data
    } else {
        print("ERROR: \(String(describing: error))")
    }
}, dataModel: ApiModel.self, "https://api-url", method: .get, parameters: parameters)
let alamofireKit = AlamofireKit()
    .headers(headers: ["Authorization": self.rawUserLoginInfo.token])
    .addParameter(key: "type", value: "AVATAR")
    .method(method: .post)
    .withImageName(imageName: "file")
    .withImageFileName(imageFileName: "file.jpg")
    .withUIButton(uiButton: self.userImageButton, imageQuality: 100)
alamofireKit.uploadImage({success, data, error in
    if success {
        print("DATA: \(data?.jsonString())")
    }
}, dataModel: ModelApiRootUploadImage.self, "https://api-url", cropSize: CGSize(width: 512, height: 512))

作者

Md. Rashed - Uz - Zaman (Rz Rasel)

许可证

AlamofireKit 使用 MIT 许可证。有关更多信息,请参阅 LICENSE 文件。