-
-
Notifications
You must be signed in to change notification settings - Fork 122
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
57 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,58 @@ | ||
# Agrume | ||
|
||
An iOS image view written in Swift with support for multiple images. | ||
|
||
## Requirements | ||
|
||
- iOS 8.0+ | ||
- Xcode 6.3+ | ||
|
||
## Installation | ||
|
||
The easiest way is through [CocoaPods](http://cocoapods.org). Simply add the dependency to your `Podfile` and then `pod install`: | ||
|
||
```ruby | ||
pod `Agrume`, `~> 1` | ||
``` | ||
|
||
## How | ||
|
||
There are multiple ways you can use the image viewer (and the included Example project shows them all). | ||
|
||
For just a single image it's as easy as | ||
|
||
```swift | ||
import Agrume | ||
|
||
@IBAction func openImage(sender: AnyObject) { | ||
if let image = UIImage(named: "…") { | ||
let agrume = Agrume(image: image) | ||
agrume.showFrom(self) | ||
} | ||
} | ||
``` | ||
|
||
You can also pass in an `NSURL` and Agrume will take care of the download for you. | ||
|
||
If you're displaying a `UICollectionView` and want to add support for zooming, you can also call Agrume with an array of either images or URLs. | ||
|
||
```swift | ||
let agrume = Agrume(images: images, startIndex: indexPath.row, backgroundBlurStyle: .Light) | ||
agrume.didScroll = { | ||
[unowned self] index in | ||
self.collectionView?.scrollToItemAtIndexPath(NSIndexPath(forRow: index, inSection: 0), | ||
atScrollPosition: .allZeros, | ||
animated: false) | ||
} | ||
agrume.showFrom(self) | ||
``` | ||
|
||
This shows a way of keeping the zoomed library and the one in the background synced. | ||
|
||
## Acknowledgements | ||
|
||
Agrume was inspired by the phenomal work done by Jared Sinclair on [JTSImageViewController](https://github.com/jaredsinclair/JTSImageViewController). This project wouldn't have seen the light of day as quickly without it. | ||
|
||
## Licence | ||
|
||
Agrume is released under the MIT license. See LICENSE for details |