-
Using the 'old' old way: imageView.kf.setImage(
// `user.pictureUri` (`URL?`) is `nil` here
with: user.pictureUri,
placeholder: UIImage(named: "UserPlaceholderImage")
) new way (expected): KF.url(user.pictureUri)
.placeholder(UIImage(named: "UserPlaceholderImage"))
.set(to: imageView) However, I can work around this by re-writing the code as: imageView.image = UIImage(named: "UserPlaceholderImage")
if let url = user.pictureUri {
KF.url(url).set(to: imageView)
} which, while still fairly clean, doesn't benefit from using KF's new chainable API for all my UIImageView needs If this was a deliberate decision, that's okay, too! I was merely expecting the two APIs to be identical in their capabilities. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Umm, it is a trade-off between strictness and flexibility. The reason is I was receiving a bunch of issues that complains the image is not loaded. And at last, I have to ask them to check whether the URL is But on the other hand, I guess yes, you are right on it. In this particular case, flexibility is more important. Converting a |
Beta Was this translation helpful? Give feedback.
Umm, it is a trade-off between strictness and flexibility. The reason is I was receiving a bunch of issues that complains the image is not loaded. And at last, I have to ask them to check whether the URL is
nil
or not again and again.But on the other hand, I guess yes, you are right on it. In this particular case, flexibility is more important.
Converting a
non-optional
parameter to an optional one does not break the current API and I guess I can do it very soon. Stay tuned!