Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update KingfisherSource.swift #417

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions ImageSlideshow/Classes/Core/ZoomAnimatedTransitioning.swift
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,11 @@ open class ZoomAnimatedTransitioningDelegate: NSObject, UIViewControllerTransiti
}

func handleSwipe(_ gesture: UIPanGestureRecognizer) {
guard let referenceSlideshowController = referenceSlideshowController else {
guard let referenceSlideshowController = referenceSlideshowController, let view = gesture.view else {
return
}

let percent = min(max(abs(gesture.translation(in: gesture.view!).y) / 200.0, 0.0), 1.0)
let percent = min(max(abs(gesture.translation(in: view).y) / 200.0, 0.0), 1.0)

if gesture.state == .began {
interactionController = UIPercentDrivenInteractiveTransition()
Expand Down
13 changes: 12 additions & 1 deletion ImageSlideshow/Classes/InputSources/KingfisherSource.swift
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,18 @@ public class KingfisherSource: NSObject, InputSource {
case .success(let image):
callback(image.image)
case .failure:
callback(self.placeholder)
var failureImage: UIImage?

for option in self.options ?? [] {
switch option {
case .onFailureImage(let image):
failureImage = image
default:
continue
}
}

callback(failureImage ?? self.placeholder)
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions Package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
"repositoryURL": "https://github.com/onevcat/Kingfisher.git",
"state": {
"branch": null,
"revision": "349ed06467a6f8a4939bcb83db301542bc84eac9",
"version": "5.13.4"
"revision": "b6f62758f21a8c03cd64f4009c037cfa580a256e",
"version": "7.9.1"
}
},
{
Expand Down
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ let package = Package(
targets: ["ImageSlideshowKingfisher"])
],
dependencies: [
.package(url: "https://github.com/onevcat/Kingfisher.git", from: "5.8.0"),
.package(url: "https://github.com/onevcat/Kingfisher.git", from: "7.9.1"),
.package(url: "https://github.com/Alamofire/AlamofireImage.git", from: "4.0.0"),
.package(url: "https://github.com/SDWebImage/SDWebImage.git", from: "5.1.0")
],
Expand Down