Skip to content

Commit

Permalink
Parameter renaming
Browse files Browse the repository at this point in the history
  • Loading branch information
JanGorman committed May 6, 2018
1 parent 89bdf51 commit 519ef6a
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 17 deletions.
9 changes: 6 additions & 3 deletions Agrume/Agrume.swift
Original file line number Diff line number Diff line change
Expand Up @@ -171,11 +171,14 @@ public final class Agrume: UIViewController {

private var downloadTask: URLSessionDataTask?

public func showFrom(_ viewController: UIViewController, backgroundSnapshotVC: UIViewController? = nil) {
/// Present Agrume
/// - Parameter viewController: The UIViewController to present from
/// - Parameter backgroundSnapshotVC: Optional UIViewController that will be used as basis for a blurred background
public func show(from viewController: UIViewController, backgroundSnapshotVC: UIViewController? = nil) {
backgroundSnapshot = (backgroundSnapshotVC ?? viewControllerForSnapshot(fromViewController: viewController))?.view.snapshot()
view.isUserInteractionEnabled = false
addSubviews()
showFrom(viewController)
show(from: viewController)
}

override public func viewDidLoad() {
Expand All @@ -200,7 +203,7 @@ public final class Agrume: UIViewController {
view.addSubview(spinner)
}

private func showFrom(_ viewController: UIViewController) {
private func show(from viewController: UIViewController) {
DispatchQueue.main.async {
self.blurContainerView.alpha = 1
self.collectionView.alpha = 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ final class MultipleImagesCollectionViewController: UICollectionViewController {
agrume.didScroll = { [unowned self] index in
self.collectionView?.scrollToItem(at: IndexPath(item: index, section: 0), at: [], animated: false)
}
agrume.showFrom(self)
agrume.show(from: self)
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ final class MultipleURLsCollectionViewController: UICollectionViewController {
agrume.didScroll = { [unowned self] index in
self.collectionView?.scrollToItem(at: IndexPath(item: index, section: 0), at: [], animated: false)
}
agrume.showFrom(self)
agrume.show(from: self)
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ final class SingleImageBackgroundColorViewController: UIViewController {
}()

@IBAction private func openImage(_ sender: Any) {
agrume.showFrom(self)
agrume.show(from: self)
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ final class SingleImageModalViewController: UIViewController {

@IBAction private func openImage(_ sender: Any) {
let agrume = Agrume(image: #imageLiteral(resourceName: "MapleBacon"), background: .blurred(.regular))
agrume.showFrom(self)
agrume.show(from: self)
}

@IBAction private func close(_ sender: Any) {
Expand Down
2 changes: 1 addition & 1 deletion Example/Agrume Example/SingleImageViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ final class SingleImageViewController: UIViewController {
}()

@IBAction private func openImage(_ sender: Any) {
agrume.showFrom(self)
agrume.show(from: self)
}

}
2 changes: 1 addition & 1 deletion Example/Agrume Example/SingleURLViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ final class SingleURLViewController: UIViewController {
@IBAction private func openURL(_ sender: Any) {
let agrume = Agrume(url: URL(string: "https://www.dropbox.com/s/mlquw9k6ogvspox/MapleBacon.png?raw=1")!,
background: .blurred(.regular))
agrume.showFrom(self)
agrume.show(from: self)
}

}
15 changes: 7 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,7 @@ import Agrume
guard let image = UIImage(named: "") else { return }

let agrume = Agrume(image: image)
// Present Agrume like any regular UIViewController
present(agrume, animated: true)
agrume.show(from: self)
}

```
Expand Down Expand Up @@ -78,7 +77,7 @@ agrume.didScroll = { [unowned self] index in
at: [],
animated: false)
}
agrume.showFrom(self)
agrume.show(from: self)

```

Expand All @@ -100,7 +99,7 @@ import MapleBacon
completion(image)
}
}
agrume.showFrom(self)
agrume.show(from: self)
}
```

Expand All @@ -117,7 +116,7 @@ AgrumeServiceLocator.shared.setDownloadHandler { url, completion in
}

// Some other place
agrume.showFrom(self)
agrume.show(from: self)

```

Expand All @@ -132,7 +131,7 @@ import Agrume
let dataSource: AgrumeDataSource = MyDataSourceImplementation()
let agrume = Agrume(dataSource: dataSource)

agrume.showFrom(self)
agrume.show(from: self)

```

Expand All @@ -143,7 +142,7 @@ When showing the Agrume view controller, it'll default to taking a snapshot of t
```swift

let agrume = Agrume(image: image)
agrume.showFrom(self, backgroundSnapshotVC: self)
agrume.show(from: self, backgroundSnapshotVC: self)

```

Expand All @@ -155,7 +154,7 @@ You can customize the status bar appearance when displaying the zoomed in view.

let agrume = Agrume(image: image)
agrume.statusBarStyle = .lightContent
agrume.showFrom(self)
agrume.show(from: self)

```

Expand Down

0 comments on commit 519ef6a

Please sign in to comment.