Skip to content

z1digitalstudio/fusuma

Repository files navigation

Fusuma

Fusuma is a Swift library that provides an Instagram-like photo browser with a camera feature using only a few lines of code.
You can use Fusuma instead of UIImagePickerController. It also has a feature to take a square-sized photo.

Version Platform CI Status Carthage compatible codebeat

Preview

Images

Features

  • UIImagePickerController alternative
  • Cropping images in camera roll
  • Taking a square-sized photo and a video using AVFoundation
  • Flash: On & Off
  • Camera Mode: Front & Back
  • Video Mode
  • Colors fully customizable

Those features are available just with a few lines of code!

Installation

Manual installation

Download and drop the 'Classes' folder into your Xcode project.

Using CocoaPods

Add pod 'Fusuma' to your Podfile and run pod install. Also add use_frameworks! to the Podfile.

use_frameworks!
pod 'Fusuma'

Swift 3

The latest version does support Swift 4.2. If you're still using Swift 3, you can install Fusuma as follows:

pod 'Fusuma', git: 'git@github.com:ytakzk/Fusuma.git', branch: 'swift-3'

Fusuma Usage

Import Fusuma import Fusuma then use the following codes in some function except for viewDidLoad and give FusumaDelegate to the view controller.

let fusuma = FusumaViewController()
fusuma.delegate = self
present(fusuma, animated: true, completion: nil)
// or
navigationController?.pushViewController(fusuma, animated: true)

Delegate methods

// The image selected in single mode (from gallery or taken with the camera).
func fusumaImageSelected(_ image: UIImage, source: FusumaMode, metaData: ImageMetadata?)

// Images selected in multiple selection mode (only from the gallery).
func fusumaMultipleImageSelected(_ images: [UIImage], source: FusumaMode, metaData: [ImageMetadata])

// Called just after a video has been selected.
func fusumaVideoCompleted(withFileURL fileURL: URL)

// When camera roll is not authorized, this method is called.
func fusumaCameraRollUnauthorized()

// Optional. Called when the user taps the cancel/close button.
func fusumaCancel()

// Optional. In multiple selection mode, called when the user tries to select more photos than allowed.
func fusumaLimitReached()

How To Customize

let fusuma = FusumaViewController()
fusuma.delegate = self
// ...
fusumaCameraRollTitle = "CustomizeCameraRollTitle"
fusumaCameraTitle = "CustomizeCameraTitle" // Camera Title
fusumaTintColor: UIColor // tint color
// ...
self.present(fusuma, animated: true, completion: nil)

Properties

Prop Type Description Default
fusumaBaseTintColor UIColor Base tint color. UIColor.hex("#c9c7c8", alpha: 1.0)
fusumaTintColor UIColor Tint color. UIColor.hex("#FCFCFC", alpha: 1.0)
fusumaBackgroundColor UIColor Background color. UIColor.hex("#c9c7c8", alpha: 1.0)
fusumaCheckImage UIImage Image of check button.
fusumaCloseImage UIImage Image of close button.
fusumaCropImage Bool Whether to crop the taken image. true
fusumaSavesImage Bool Whether to save the taken image. false
fusumaCameraRollTitle String Text of camera roll title. "Library"
fusumaCameraTitle String Text of carmera title text. Photo
fusumaVideoTitle String Text of video title. Video
fusumaTitleFont UIFont Font for title text. UIFont(name: "AvenirNext-DemiBold", size: 15)

Original Author

ytakzk
https://ytakzk.me

License

Fusuma is released under the MIT license.
See LICENSE for details.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages