simple progress bar library cocoaPods
use terminal
- pod init
- open podfile
# Uncomment the next line to define a global platform for your project
platform :ios, '9.0'
target 'youProject' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
# Pods for yourProject
pod 'SVProgressHUD'
end
Use SVProgressHUD example like the way alamofire below
import SVProgressHUD
override func viewDidLoad() {
super.viewDidLoad()
SVProgressHUD.show()
DispatchQueue.main.async {
Alamofire.upload(multipartFormData: { multipartFormData in
multipartFormData.append(imageData1!, withName: "\(imageParamName)[]", fileName: "file1.png", mimeType: "image/png")
}, to: urlImage, method: .post, headers: headers,
encodingCompletion: { encodingResult in
switch encodingResult {
case .success(let upload, _, _):
upload.responseJSON { response in
debugPrint(response)
SVProgressHUD.dismiss()
}
case .failure(let encodingError):
print(encodingError)
}
}) }
}
No comments: