Latest 0.5.0
Homepage https://github.com/OlegAba/LPLivePhotoGenerator
License MIT
Platforms ios 11.0
Authors

GitHub release
GitHub license
CocoaPods

A Swift library for creating and saving Live Photos

Installation

As a CocoaPods Dependency:

Add the following to your Podfile:

pod 'LPLivePhotoGenerator'

cd into the directory where your Podfile is present and install

pod install

Manual Installation (Framework):

  1. Drag the LPLivePhotoGenerator.xcodeproj file into your Xcode project.
  2. Add LPLivePhotoGenerator.framework to "Embedded Binaries" in the "General" tab of your target.

Import the library, wherever you want to use it:

import LPLivePhotoGenerator

Usage

Creating and Saving a Live Photo:

// Create a LivePhoto object with a image path and video path
LPLivePhotoGenerator.create(inputImagePath: imagePath, inputVideoPath: videoPath) { (livePhoto: LPLivePhoto?, error: Error?) in

    // Unwrap object
    if let livePhoto = livePhoto {

        // Set the Live Photo in a PHLivePhotoView
        let livePhotoView = PHLivePhotoView(frame: rect)
        livePhotoView.livePhoto = livePhoto

        // Save Live Photo to Photo Library
        livePhoto.writeToPhotoLibrary(completion: { (livePhoto: LPLivePhoto, error: Error?) in

          if error == nil {
            ...
          }
        })
    }
}

Extra Tool (LPLivePhoto Method):

// Move paired image and video to new path
livePhoto.movePairedImageAndVideoTo(path: path, completion: { (success: Bool, error: Error?) in

    if success {
        ...
    }
})

Demo Application

The "Demo" is a basic reference application created to show how to install LPLivePhotoGenerator using CocoaPods and develop applications using this library.

Installation

CocoaPods should be installed before continuing.
To access the project, run the following:

git clone --recursive https://github.com/OlegAba/LPLivePhotoGenerator.git
cd LPLivePhotoGenerator/Demo/
pod install
open Demo.xcworkspace

You can also check out SuperSnapcode – an open-source iOS application that is built using this library

License

This project is licensed under the MIT License – see the LICENSE file for details

Latest podspec

{
    "name": "LPLivePhotoGenerator",
    "version": "0.5.0",
    "summary": "A swift library for creating and saving Live Photos.",
    "description": "Convert an image and video into a Live Photo and save it.n  The option to move the paired files with the necessary metadata to anothern  path is also provided.",
    "homepage": "https://github.com/OlegAba/LPLivePhotoGenerator",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Oleg Abalonski": "[email protected]"
    },
    "social_media_url": "https://github.com/OlegAba",
    "platforms": {
        "ios": "11.0"
    },
    "source": {
        "git": "https://github.com/OlegAba/LPLivePhotoGenerator.git",
        "tag": "0.5.0"
    },
    "source_files": "LPLivePhotoGenerator/**/*swift",
    "swift_version": "4.2"
}

Pin It on Pinterest

Share This