ZoomableImageView

1.0.2

Simple SwiftUI ImageView that enables dragging and zooming.
rushairer/ZoomableImageView

What's New

Release v1.0.2

2021-10-19T16:29:50Z

ZoomableImageView

GitHub code size in bytes GitHub GitHub release (latest by date including pre-releases) GitHub tag (latest by date)

Simple SwiftUI ImageView that enables dragging and zooming.

Declaration

struct ZoomableImageView

Overview

Double Tap the view will zoom-in.

ZoomableImageView(image: UIImage(systemName: "photo")!)
@State var image: UIImage = UIImage()

var body: some View {
    ZoomableImageView(image: image, maximumZoomScale: 10)
        .task {
            do {
                let url = URL(string: "https://apod.nasa.gov/apod/image/2108/PlutoEnhancedHiRes_NewHorizons_960.jpg")!
                let (imageLocalURL, _) = try await URLSession.shared.download(from: url)
                let imageData = try Data(contentsOf: imageLocalURL)
                image = UIImage(data: imageData)!
            } catch {
                print(error)
            }
        }
}

History

History

LICENSE

The MIT License (MIT)

Description

  • Swift Tools 5.5.0
View More Packages from this Author

Dependencies

  • None
Last updated: Thu Dec 22 2022 11:35:04 GMT-0500 (GMT-05:00)