Latest 1.0.1
Homepage https://github.com/zh-wang/MomentsPicker
License MIT
Platforms ios 8.3, requires ARC
Frameworks Photos
Authors

iOS Moments-like image picking library

CI Status
Version
License
Platform

Sample Image

Usage

This lib provides a moment-like style for picking multiple images from iOS device’s gallery.

Only support for picking static images. So GIFs or videos will be treated as static images.

How to use

// ----------
// Ask for photo access first
Utils.safetyPhotoPickerWrapper(allowBlock: {
    // Use custom configurations here
    let config = MPConfig()
    config.selectionRange = (1, 2)
    config.showSelectedCounter = true
    config.startingContents = .Moments

    // Add a static foot view
    let label = UILabel(frame: CGRectMake(0, 0, UIScreen.mainScreen().bounds.width, 44))
    label.text = "Select 1 - 2 photos"
    label.textColor = UIColor.blackColor()
    label.backgroundColor = UIColor.lightGrayColor()
    label.textAlignment = NSTextAlignment.Center
    config.staticFooterView = label

    self.presentViewController(MPRootViewController.newInstance(delegate: self, config: config), animated: true, completion: nil)

}, notAllowBlock: {
    // Not allowed. Please Enable Photo Access in settings.
})
// ----------

Other configuration options(See MPConfig.swift)

// ---------- MPConfig.swift -----------
public enum MPContentsType {
    case Category
    case Moments
    case AllPhotos
}

public enum MPStartingPosition {
    case TOP
    case BOTTOM
}

public class MPConfig {

    // Configurations
    public var onlyIncludeStaticImage = true
    public var selectionRange: (Int, Int)? = nil
    public var staticFooterView: UIView? = nil
    public var showSelectedCounter = true
    public var startingContents = MPContentsType.Moments
    public var startingPosition = MPStartingPosition.BOTTOM

    // You can provide localizations text here
    public var viewControllerTitlePhotos = "Photos"
    public var viewControllerTitleMoments = "Moments"
    public var barBtnTitleDone = "Done"
    public var barBtnTitleCancel = "Cancel"
    public var categoryTitleAllPhotos = "All Photos"
    public var categoryTitleMoments = "Moments"
    public var categoryTitleSmartAlbums = "Smart Albums"
    public var categoryTitleUserAlbums = "User Albums"
    public var selectedCounterText = "%d selected"

    public init() {
        onlyIncludeStaticImage = true
    }

    func safetyCheck() {
        assert(selectedCounterText.componentsSeparatedByString("%d").count == 2, "only one %d is expected")
    }

}

Requirements

iOS 8.3
Use Photos framework

Installation

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

pod "MomentsPicker"

Author

zh-wang, [email protected]

License

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

Latest podspec

{
    "name": "MomentsPicker",
    "version": "1.0.1",
    "summary": "iOS Moments-like image picking library",
    "description": "iOS Moments-like image picking library with multiple selection support.",
    "homepage": "https://github.com/zh-wang/MomentsPicker",
    "screenshots": "http://i.imgur.com/jskUS9P.png",
    "license": "MIT",
    "authors": {
        "zh-wang": "[email protected]"
    },
    "source": {
        "git": "https://github.com/zh-wang/MomentsPicker.git",
        "tag": "1.0.1"
    },
    "social_media_url": "https://twitter.com/viennakanon",
    "platforms": {
        "ios": "8.3"
    },
    "requires_arc": true,
    "source_files": "Pod/Classes/**/*",
    "resource_bundles": {
        "MomentsPicker": [
            "Pod/Assets/*.png"
        ]
    },
    "frameworks": "Photos"
}

Pin It on Pinterest

Share This