MomentsGallery is a gallery view controller inspired by Twitter's Moments. It includes a parallax effect while swiping between photos, tap to view the full photo and the ability to add a title and a caption.
To run the example project, clone the repo, and run pod install
from the Example directory first.
var images = ["1.jpg", "2.jpg", "3.jpg"]
var moments: [Moment] = []
for imagePath in images {
let moment = Moment(image: UIImage(named: imagePath))
moments.append(moment)
}
let momentsVC = MomentsGallery(moments: moments)
self.presentViewController(momentsVC, animated: true, completion: nil)
var images = ["http://url.com/1.jpg", "http://url.com/2.jpg", "http://url.com/3.jpg"]
var moments: [Moment] = []
for imageUrl in images {
let moment = Moment(url: imageUrl)
moments.append(moment)
}
let momentsVC = MomentsGallery(moments: moments)
self.presentViewController(momentsVC, animated: true, completion: nil)
let momentsVC = MomentsGallery(moments: [moment, moment, moment])
momentsVC.initialPageIndex = 2 // Set initial index before presenting, not animated
self.presentViewController(momentsVC, animated: true, completion: nil)
momentsVC.scrollToIndex(2) // Set index after view controller is presented, animated
- Swift 2.1
- iOS 8.2
MomentsGallery is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod "MomentsGallery"
To install MomentsView with Carthage add the following line to your cartfile
github "Fortyfox/MomentsGallery" ~> 0.1.0
Melvin Beemer, [email protected]
MomentsGallery is available under the MIT license. See the LICENSE file for more info.