You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Okay, I'm good to add the completionHandler: label. But after some "auto fix"s and "auto completion"s. Some API callings could be ambiguous to my colleagues, like:
imageView.kf.setImage(with: LocalFileImageDataProvider(fileURL: URL(string: "")!)) { (_, _) in
// How do I know this is a progress block from this API perspective?
} completionHandler: { _ in
}
This might not be an issue with Kingfisher. But IMO some API improvements could be made.
At least we should prevent Xcode to automatically hide the progressBlock:.
I'd prefer something like what Alamofire did:
AF.download("")
.downloadProgress { _ in
}
.responseJSON { _ in
}
Regards.
The text was updated successfully, but these errors were encountered:
It is a quite annoying change in Swift 5.3, basically only for writing better SwiftUI code. For any other use cases, it is a bit of regression to apply the new trailing closure rule.
For you case, if you have both the progress block and completion block, try to explicitly name the first block to avoid the ambiguous meaning:
The factory pattern is very nice in Alamofire and it definitely a good direction to improve the API. But it requires a major upgrade and I will consider if it is easy enough to migrate. I will try to see it I can implement it soon. Thank you for your suggestion.
Check List
Thanks for considering to open an issue. Before you submit your issue, please confirm these boxes are checked.
Issue Description
I was just compiling our code base with Xcode 12. I got a dozens warnings sort of:
Seems like this new proposal trying to catch my eyes.
https://forums.swift.org/t/se-0286-forward-scan-for-trailing-closures/38529
Okay, I'm good to add the
completionHandler:
label. But after some "auto fix"s and "auto completion"s. Some API callings could be ambiguous to my colleagues, like:This might not be an issue with Kingfisher. But IMO some API improvements could be made.
At least we should prevent Xcode to automatically hide the
progressBlock:
.I'd prefer something like what Alamofire did:
Regards.
The text was updated successfully, but these errors were encountered: