Skip to content

Commit

Permalink
Merge pull request #87 from hebertialmeida/master
Browse files Browse the repository at this point in the history
Using SKPhotoProtocol to enable usage from SKLocalPhoto and SKPhoto
  • Loading branch information
alexanderkhitev committed Apr 19, 2016
2 parents ca7e215 + 8faf42b commit 035fc44
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ See the code snippet below for an example of how to implement, or example projec

```swift
// add SKPhoto Array from UIImage
var images = [SKPhoto]()
var images = [SKPhotoProtocol]()
let photo = SKPhoto.photoWithImage(UIImage())// add some UIImage
images.append(photo)

Expand All @@ -60,7 +60,7 @@ presentViewController(browser, animated: true, completion: {})
from web URLs:
```swift
// URL pattern snippet
var images = [SKPhoto]()
var images = [SKPhotoProtocol]()
let photo = SKPhoto.photoWithImageURL("https://placehold.jp/150x150.png")
photo.shouldCachePhotoURLImage = false // you can use image cache by true(NSCache)
images.append(photo)
Expand All @@ -73,7 +73,7 @@ presentViewController(browser, animated: true, completion: {})
from local files:
```swift
// images from local files
var images = [SKLocalPhoto]()
var images = [SKPhotoProtocol]()
let photo = SKLocalPhoto.photoWithImageURL("..some_local_path/150x150.png")
images.append(photo)

Expand Down
2 changes: 1 addition & 1 deletion SKPhotoBrowser.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "SKPhotoBrowser"
s.version = "1.8.3"
s.version = "1.8.4"
s.summary = "Simple PhotoBrowser/Viewer inspired by facebook, twitter photo browsers written by swift2.0."
s.homepage = "https://github.com/suzuki-0000/SKPhotoBrowser"
s.license = { :type => "MIT", :file => "LICENSE" }
Expand Down
4 changes: 2 additions & 2 deletions SKPhotoBrowser/SKPhotoBrowser.swift
Original file line number Diff line number Diff line change
Expand Up @@ -203,15 +203,15 @@ public class SKPhotoBrowser: UIViewController, UIScrollViewDelegate {
setup()
}

public convenience init(photos: [SKPhoto]) {
public convenience init(photos: [SKPhotoProtocol]) {
self.init(nibName: nil, bundle: nil)
for photo in photos {
photo.checkCache()
self.photos.append(photo)
}
}

public convenience init(originImage: UIImage, photos: [SKPhoto], animatedFromView: UIView) {
public convenience init(originImage: UIImage, photos: [SKPhotoProtocol], animatedFromView: UIView) {
self.init(nibName: nil, bundle: nil)
self.senderOriginImage = originImage
self.senderViewForAnimation = animatedFromView
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ class CameraRollViewController: UIViewController, SKPhotoBrowserDelegate, UIColl

func open(images:[UIImage]) {

let photoImages:[SKPhoto] = images.map({ return SKPhoto.photoWithImage($0) })
let photoImages:[SKPhotoProtocol] = images.map({ return SKPhoto.photoWithImage($0) })
let browser = SKPhotoBrowser(originImage: cell.exampleImageView.image!, photos: photoImages, animatedFromView: cell)

browser.initializePageIndex(indexPath.row)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class ViewController: UIViewController, UICollectionViewDataSource, UICollection
private var screenHeight: CGFloat { return screenBound.size.height }

@IBOutlet weak var collectionView: UICollectionView!
var images = [SKPhoto]()
var images = [SKPhotoProtocol]()
var caption = ["Lorem Ipsum is simply dummy text of the printing and typesetting industry.",
"Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book",
"It has survived not only five centuries, but also the leap into electronic typesetting",
Expand Down

0 comments on commit 035fc44

Please sign in to comment.