Skip to content

Fortyfox/MomentsGallery

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MomentsGallery

Version License Platform

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"

To install MomentsView with Carthage add the following line to your cartfile

github "Fortyfox/MomentsGallery" ~> 0.1.0

Author

Melvin Beemer, melvin.beemer@gmail.com

License

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

About

MomentsGallery is a gallery view controller inspired by Twitter's Moments.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Swift 83.4%
  • Shell 14.5%
  • Ruby 1.1%
  • Objective-C 1.0%