Swiftpack.co - vospennikov/InteractiveImageView as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by vospennikov.
vospennikov/InteractiveImageView v1.0.4
Image and ImageView with zoom, scroll and rotation
⭐️ 0
🕓 8 weeks ago
iOS
.package(url: "https://github.com/vospennikov/InteractiveImageView.git", from: "v1.0.4")

InteractiveImageView

Swift Platform Framework Swift Package Manager GitHub

Demo

Image view with support for zoom, scroll, and rotation. Support SwiftUI and UIKit.

Usage

SwiftUI

@State var tapLocation: CGPoint = .zero
InteractiveImage(image: .init(named: "Iceland"), handleZoomingTap: $tapLocation)

SwiftUI before iOS 16 didn't support touch location detection. To zoom to the touch location, you could use the Gestures package.

.onTouchGesture(count: 2) { gesture in
  tapLocation = gesture.location
}

UIKit

var interactiveImageView = InteractiveImageView(maxScale: 2.0)
interactiveImageView.image = UIImage(named: "Iceland")

func gestureHandler(_ sender: UITapGestureRecognizer) {
  let location = sender.location(in: imageView)
  interactiveImageView.zoom(to: location, animated: true)
}

Installation

Swift Package Manager

Add the following dependency to your Package.swift file:

.package(url: "https://github.com/vospennikov/InteractiveImageView.git", .upToNextMinor(from: "1.0.4"))

License

Gestures is available under the MIT license. See the LICENSE file for more info.

GitHub

link
Stars: 0
Last commit: 2 weeks ago
jonrohan Something's broken? Yell at me @ptrpavlik. Praise and feedback (and money) is also welcome.

Release Notes

2 weeks ago

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics