Skip to content

Commit

Permalink
Completion
Browse files Browse the repository at this point in the history
  • Loading branch information
JanGorman committed Mar 1, 2020
1 parent aea92c4 commit 3a3cde2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion MapleBacon.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'MapleBacon'
s.version = '6.0.4'
s.version = '6.0.5'
s.swift_version = '5.1'
s.summary = 'A lightweight and fast image downloading library iOS.'

Expand Down
6 changes: 5 additions & 1 deletion MapleBacon/Extensions/UIImageView+MapleBacon.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ extension UIImageView {
public func setImage(with url: URL?,
placeholder: UIImage? = nil,
displayOptions: [DisplayOptions] = [],
imageTransformer: ImageTransforming? = nil) {
imageTransformer: ImageTransforming? = nil,
completion: (() -> Void)? = nil) {
baconImageUrl = url
guard let url = url else {
return
Expand All @@ -33,6 +34,9 @@ extension UIImageView {
let transformer = makeTransformer(displayOptions: displayOptions, imageTransformer: imageTransformer)

MapleBacon.shared.image(with: url, imageTransformer: transformer) { [weak self] result in
defer {
completion?()
}
guard case let Result.success(image) = result, let self = self, url == self.baconImageUrl else {
return
}
Expand Down

0 comments on commit 3a3cde2

Please sign in to comment.