CocoaPods trunk is moving to be read-only. Read more on the blog, there are 18 months to go.

MomentsGallery 0.1.3

MomentsGallery 0.1.3

TestsTested
LangLanguage SwiftSwift
License MIT
ReleasedLast Release Apr 2016
SPMSupports SPM

Maintained by Melvin Beemer.




MomentsGallery

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.

MomentsGallery Exmaple

Usage

To run the example project, clone the repo, and run pod install from the Example directory first.

Local images

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)

Images from the web

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)

Controlling the page index

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

Requirements

  • Swift 2.1
  • iOS 8.2

Dependencies

Installation

MomentsGallery is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod "MomentsGallery"

Author

Melvin Beemer, [email protected]

License

MomentsGallery is available under the MIT license. See the LICENSE file for more info.