change convenience init for SKPhotoBrowser to only take object that conform to SKPhotoProtocol

This commit is contained in:
Antoine Barrault 2016-04-13 10:15:03 -03:00
parent c4d04f9ff6
commit 3204bbb5cb
1 changed files with 8 additions and 12 deletions

View File

@ -203,25 +203,21 @@ public class SKPhotoBrowser: UIViewController, UIScrollViewDelegate {
setup()
}
public convenience init(photos:[ AnyObject]) {
public convenience init(photos: [SKPhotoProtocol]) {
self.init(nibName: nil, bundle: nil)
for anyObject in photos {
if let photo = anyObject as? SKPhotoProtocol {
photo.checkCache()
self.photos.append(photo)
}
for photo in photos {
photo.checkCache()
self.photos.append(photo)
}
}
public convenience init(originImage: UIImage, photos: [AnyObject], animatedFromView: UIView) {
public convenience init(originImage: UIImage, photos: [SKPhotoProtocol], animatedFromView: UIView) {
self.init(nibName: nil, bundle: nil)
self.senderOriginImage = originImage
self.senderViewForAnimation = animatedFromView
for anyObject in photos {
if let photo = anyObject as? SKPhotoProtocol {
photo.checkCache()
self.photos.append(photo)
}
for photo in photos {
photo.checkCache()
self.photos.append(photo)
}
}