Latest0.1.1
Homepagehttps://github.com/gajjartejas/SMDImagePicker
LicenseMIT
Platformsios 8.0, requires ARC
Authors

SMDImagePicker

Twitter: @gajjartejas
License: MIT
Version
Cocoapods

A Clouser based UIImagePickerController wrapper in Swift.


SMDImagePicker

Demo

Do pod try SMDImagePicker in your console and run the project to try a demo.
To install CocoaPods, run sudo gem install cocoapods in your console.

Installation 📱

This branch supports Swift 4.

CocoaPods

Use CocoaPods.

  1. Add pod 'SMDImagePicker' to your Podfile.
  2. Install the pod(s) by running pod install.
  3. Add import SMDImagePicker in the .swift files where you want to use it

Source files

A regular way to use SMDImagePicker in your project would be using Embedded Framework. There are two approaches, using source code.

Add source code:

  1. Download the latest code version.
  2. Unzip the download file, copy SMDImagePicker folder to your project folder

After you get the source code either by adding it directly or using submodule, then do the following steps:

  • Open SMDImagePicker folder, and drag SMDImagePicker.xcodeproj into the file navigator of your app project, under you app project.
  • In Xcode, navigate to the target configuration window by clicking the blue project icon, and selecting the application target under the "Targets" heading in the sidebar.
  • Open "Build Phases" panel in the tab bar at the top of the window, expend the "Target Dependencies" group and add SMDImagePicker.framework under SMDImagePicker icon in the popup window by clicking +. Similarly, you can also add SMDImagePicker.framework in "Embedded Binaries" under "General" tab.

Basic usage ✨


import SMDImagePicker
import MobileCoreServices

let imagePicker = SMDImagePicker()

//For Gallary Images
//Optional
let photoGallaryOptions = SMDImagePicker.PhotoGallaryOptions(allowsEditing: true,
                                                             mediaTypes: [kUTTypeImage as String])
imagePicker.configure(photoGallaryOptions)
imagePicker.choose(media: .choosePhoto, presentFrom: self) { (media, status) in
    if status == .success {
        //You will get media?.editedImage or media?.originalImage if cropping is disabled.
    } else {
        //See example for error handling
}

//For Image Capture From Camera 
//Optional
let options =  SMDImagePicker.PhotoCaptureOptions(allowsEditing: true,
                                                  cameraDevice: .rear,
                                                  mediaTypes: [kUTTypeImage as String],
                                                  flashMode: .auto)
imagePicker.configure(options)
imagePicker.capture(media: .takePhoto, presentFrom: self) { (media, status) in
    if status == .success {
        //You will get media?.editedImage or media?.originalImage if cropping is disabled.
    } else {
        //See example for error handling
    }
}

//For Gallary Video
//Optional
let options = SMDImagePicker.VideoGallaryOptions(allowsEditing: false,
                                                             mediaTypes: [kUTTypeMovie as String],
                                                             maximumDuration: 2*60, //Duration 2 Minutes
                                                             quality: UIImagePickerControllerQualityType.typeMedium)
imagePicker.configure(photoGallaryOptions)
imagePicker.choose(media: .chooseVideo, presentFrom: self) { (media, status) in
    if status == .success {
        //Here you will get media?.mediaURL for video
        //For Video thumb image?.videoThumb
    } else {
        //See example for error handling
    }

//For Record Video
//Optional
let options = SMDImagePicker.VideoRecorderOptions(allowsEditing: true,
                                                  cameraDevice: .rear,
                                                  maximumDuration: 2*60, //Duration 2 Minutes
                                                  quality: .typeHigh,
                                                  flashMode: .auto)

imagePicker.configure(options)
imagePicker.capture(media: .takeVideo, presentFrom: self) { (media, status) in
    if status == .success {
        //Here you will get media?.mediaURL for video
        //For Video thumb image?.videoThumb
    } else {
       //See example for error handling
    }

Latest podspec

{
    "name": "SMDImagePicker",
    "version": "0.1.1",
    "summary": "A UIImagePickerController wrapper.",
    "description": "UIImagePickerController Block-based wrapper.",
    "homepage": "https://github.com/gajjartejas/SMDImagePicker",
    "screenshots": "https://github.com/gajjartejas/SMDImagePicker/blob/master/Screenshots/logo.png?raw=true",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "gajjartejas": "[email protected]"
    },
    "social_media_url": "https://twitter.com/gajjartejas",
    "platforms": {
        "ios": "8.0"
    },
    "source": {
        "git": "https://github.com/gajjartejas/SMDImagePicker.git",
        "tag": "v0.1.1"
    },
    "source_files": [
        "SMDImagePicker",
        "SMDImagePicker/**/*.swift"
    ],
    "requires_arc": true,
    "pushed_with_swift_version": "4.0"
}

Pin It on Pinterest

Share This