Skip to content

Commit

Permalink
Merge pull request #102 from jrsaruo/release-0.1.3
Browse files Browse the repository at this point in the history
Release 0.1.3
  • Loading branch information
jrsaruo authored Feb 13, 2024
2 parents de0e1c9 + 1248ad3 commit f7c26ac
Show file tree
Hide file tree
Showing 11 changed files with 472 additions and 173 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@ final class SyncImagesViewController: UIViewController {
)
}

// MARK: - Methods

private func refresh() {
var snapshot = NSDiffableDataSourceSnapshot<Int, Item>()
snapshot.appendSections([0])
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ See demo for more detailed usage.
To use the `MediaViewer` library in a SwiftPM project, add the following line to the dependencies in your `Package.swift` file:

```swift
.package(url: "https://github.com/jrsaruo/MediaViewer", from: "0.1.2"),
.package(url: "https://github.com/jrsaruo/MediaViewer", from: "0.1.3"),
```

and add `MediaViewer` as a dependency for your target:
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@

import UIKit

@MainActor
protocol MediaViewerOnePageViewDelegate: AnyObject {
func mediaViewerOnePageViewDidZoom(_ onePageView: MediaViewerOnePageView)
}

final class MediaViewerOnePageView: UIView {

private enum LayoutState {
Expand All @@ -20,6 +25,8 @@ final class MediaViewerOnePageView: UIView {
case destroyedForTransition
}

weak var delegate: (any MediaViewerOnePageViewDelegate)?

let scrollView: UIScrollView = {
let scrollView = UIScrollView()
scrollView.contentInsetAdjustmentBehavior = .never
Expand Down Expand Up @@ -242,5 +249,6 @@ extension MediaViewerOnePageView: UIScrollViewDelegate {

func scrollViewDidZoom(_ scrollView: UIScrollView) {
adjustContentInset()
delegate?.mediaViewerOnePageViewDidZoom(self)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,8 @@ import UIKit
protocol MediaViewerOnePageViewControllerDelegate: AnyObject {
func mediaViewerPageTapped(_ mediaViewerPage: MediaViewerOnePageViewController)

func mediaViewerPage(
_ mediaViewerPage: MediaViewerOnePageViewController,
didDoubleTap imageView: UIImageView
func mediaViewerPageDidZoom(
_ mediaViewerPage: MediaViewerOnePageViewController
)
}

Expand Down Expand Up @@ -48,6 +47,7 @@ final class MediaViewerOnePageViewController: UIViewController {
// MARK: - Lifecycle

override func loadView() {
mediaViewerOnePageView.delegate = self
view = mediaViewerOnePageView
}

Expand Down Expand Up @@ -93,7 +93,15 @@ final class MediaViewerOnePageViewController: UIViewController {

@objc
private func imageDoubleTapped(recognizer: UITapGestureRecognizer) {
delegate?.mediaViewerPage(self, didDoubleTap: mediaViewerOnePageView.imageView)
mediaViewerOnePageView.updateZoomScaleOnDoubleTap(recognizedBy: recognizer)
}
}

// MARK: - MediaViewerOnePageViewDelegate -

extension MediaViewerOnePageViewController: MediaViewerOnePageViewDelegate {

func mediaViewerOnePageViewDidZoom(_ onePageView: MediaViewerOnePageView) {
delegate?.mediaViewerPageDidZoom(self)
}
}
Loading

0 comments on commit f7c26ac

Please sign in to comment.