Instagram-like photo browser and a camera feature with a few line of code in Swift.

Overview

NOTE: This project is no longer maintained.

We highly recommend YPImagePicker.

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: '[email protected]: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
fusuma.availableModes = [FusumaMode.library, FusumaMode.camera, FusumaMode.video] // Add .video capturing mode to the default .library and .camera modes
fusuma.cropHeightRatio = 0.6 // Height-to-width ratio. The default value is 1, which means a squared-size photo.
fusuma.allowMultipleSelection = true // You can select multiple photos from the camera roll. The default value is false.
self.present(fusuma, animated: true, completion: nil)

Delegate methods

// Return the image which is selected from camera roll or is taken via the camera.
func fusumaImageSelected(_ image: UIImage, source: FusumaMode) {

  print("Image selected")
}

// Return the image but called after is dismissed.
func fusumaDismissedWithImage(image: UIImage, source: FusumaMode) {
        
  print("Called just after FusumaViewController is dismissed.")
}

func fusumaVideoCompleted(withFileURL fileURL: URL) {

  print("Called just after a video has been selected.")
}

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

  print("Camera roll unauthorized")
}

// Return selected images when you allow to select multiple photos.
func fusumaMultipleImageSelected(_ images: [UIImage], source: FusumaMode) {

}

// Return an image and the detailed information.
func fusumaImageSelected(_ image: UIImage, source: FusumaMode, metaData: ImageMetadata) {

}

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)

Fusuma for Xamarin

Cheesebaron developed Chafu for Xamarin.
https://github.com/Cheesebaron/Chafu

Author

ytakzk
https://ytakzk.me

Donation

Your support is welcome through Bitcoin 3Ps8tBgz4qn6zVUr5D1wcYrrzYjMgEugqv

License

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

Comments
  • What about Swift 3 version ?

    What about Swift 3 version ?

    Hey thank you for this work !! But when do you think the swift 3 version will be available for a pod update please ? Seem that many developers have issues with Swift 3 upgrade :/

    opened by sebastienboulogne 18
  • Images not rendering in collection view of FSAlbumView in iPad Air and iPad Air 2.

    Images not rendering in collection view of FSAlbumView in iPad Air and iPad Air 2.

    The images in the collectionView of the FSAlbumView are not being rendered in iPad Air and iPad Air 2. The frames are there. Also if I give the background color to the imageView the the background colors are visible. Even when I select the cell, the corresponding image is shown in the imageCropView. But the images are not being rendered in the collection view.

    blackclosed1 redclosed1 blackopen1 redopen1

    opened by leapfrog-saugat 13
  • Crash after updating to iOS 10 , swift 3

    Crash after updating to iOS 10 , swift 3

    after updating to iOS 10 and swift3 when i opened gallery from fusuma* , application got crashed without any log message the only message i got is this : (lldb) and its pointing to - -> 0x185cbcd74 <+8>: b.lo 0x185cbcd8c ; <+32> how can we fix this ??

    opened by billionbucks 10
  • Videos are Muted

    Videos are Muted

    I'm recording videos but they do not have sounds:

    let vc = FusumaViewController()
    vc.hasVideo = true
    vc.delegate = self
    presentViewController(vc, animated: true, completion: nil)
    
    opened by shakked 8
  • A little appearance problem when changing flash mode

    A little appearance problem when changing flash mode

    iosghy02172016144050

    When I clicked the flash button

    iosghy02172016144059

    Another problem is I think you always set the off image to flash button at the beginning no matter the flash mode is on or off.

    opened by ghysrc 8
  •  Integrating Fusuma in my objective-c

    Integrating Fusuma in my objective-c

    Hi there

    I am integrating Fusuma in my objective-c app

    Now i am able to acess FusumaViewController but not able to acess the FusumaDelegate

    I have seen my projectName-Swift.h file i can see the FusumaViewController's function but can not able to see the delegate function in it

    Can someone please help me to resolve the issue

    Thanks in advance

    bug 
    opened by anitalanet 7
  • Wrong crop height ratio according to available modes.

    Wrong crop height ratio according to available modes.

    It is strange for me:

    fusuma.cropHeightRatio = 1.0
    fusumaCropImage = true
    

    I expect the photo to be square. And if:

    fusuma.availableModes = [FusumaMode.camera, FusumaMode.library]
    

    or

    fusuma.availableModes = [FusumaMode.video, FusumaMode.camera]
    

    Everything is good, the area of the photo and the photo itself are square. But if:

    fusuma.availableModes = [FusumaMode.camera]
    

    Despite cropHeightRatio and fusumaCropImage, photo area and photo itself are rectangular.

    bug 
    opened by melancholy13 6
  • Little Space at the bottom(with screen shots)

    Little Space at the bottom(with screen shots)

    First of all, this is a great framework! Thanks a lot!

    May I ask why there's a little small white space at the bottom that is not filled for the first time when I present the fusuma viewcontroller?

    The picture below: first picture is the first time enter in the viewcontroller, the second one is when I tapped back for the second time.

    fullsizeoutput_a73 fullsizeoutput_a74

    opened by Bomiishere 6
  • #242 - Correcting top layout constraints

    #242 - Correcting top layout constraints

    With the new top layout/margin behaviours, the top "nav bar" would appear below the status bar.

    Corrected the constraints to ensure the nav bar covers behind the status bar area. Tested on iPhone 7, but should also fix the problem as reported on iPhone X.

    opened by rstewart22 5
  • Album starts dragging up when I want to crop image

    Album starts dragging up when I want to crop image

    Thanks for a great project!

    In album view

    After having dragged the album up once to reveal more images and then selected one, pinching to zoom/crop and panning the loaded image with one or two fingers would start the dragging up of the album, but the intended action is rather to pinch to zoom or pan the crop view.

    Adding a class variable solved this issue

    var canPanDuringThisTouch = true
    

    Then add the line to the panned() function

        if sender.state == .Began {
    
            let view    = sender.view
            let loc     = sender.locationInView(view)
            let subview = view?.hitTest(loc, withEvent: nil)
    
            if subview == imageCropView && imageCropViewConstraintTop.constant == imageCropViewOriginalConstraintTop {
                // if the pan starts in the image field, don't let this touch start dragging the album, since it's a crop gesture
                canPanDuringThisTouch = false
                return
            }
    

    and in the last } else { , add:

            canPanDuringThisTouch = true // reset this value for the next interaction
    
    opened by thyselius 5
  • Scheme Fusuma is not currently configured for the build action

    Scheme Fusuma is not currently configured for the build action

    Hi, I've just tried to install Fusuma and I get the following error:

    A shell task (/usr/bin/xcrun xcodebuild -workspace /Carthage/Checkouts/Fusuma/Fusuma.xcworkspace -scheme Fusuma -configuration Release CODE_SIGNING_REQUIRED=NO CODE_SIGN_IDENTITY= CARTHAGE=YES -showBuildSettings) failed with exit code 66: xcodebuild: error: Scheme Fusuma is not currently configured for the build action.

    Researching on Carthage issues (https://github.com/Carthage/Carthage/issues/896), I've found that it's an issue with the library. I also tried to install version 0.4.0 and it works, so it's probably an issue with the latest version (0.5.1).

    What should I do?

    opened by rodrigoruiz 5
  • Unable to get path from phAsset

    Unable to get path from phAsset

    I want to get the path of selected images. But, using phAsset from metadata returns nil. I tried the following: None of the ways in the following function worked. ` func getImagesFromAsset(asset: PHAsset) -> URL? { var finalURL: URL?

        let options: PHContentEditingInputRequestOptions = PHContentEditingInputRequestOptions()
        options.canHandleAdjustmentData = {(adjustmeta: PHAdjustmentData) -> Bool in
            return true
        }
    

    // PHImageManager.default().requestImage(for: asset, targetSize: CGSize(width: 600, height: 600), contentMode: .aspectFill, options: nil, resultHandler: { (image, info) in // //resultHandler have info ([AnyHashable: Any]) // print(info!["PHImageFileURLKey"]) // finalURL = info!["PHImageFileURLKey"] as! URL // // })

        let imageRequestOptions = PHImageRequestOptions()
        PHImageManager.default().requestImageData(for: asset, options: imageRequestOptions, resultHandler: { imageData, dataUTI, orientation, info in
          if let info = info {
            print("info = \(info)")
          }
          if info?["PHImageFileURLKey"] != nil {
    
            let path = info?["PHImageFileURLKey"] as? URL
             print(path) //here you get complete URL
    
    
            // if you want to save image in document see this.
           // self.saveimageindocument(imageData, withimagename: "DEMO")
          }
        })
        
        asset.requestContentEditingInput(with: options) { (editingInput, info) in
            if asset.mediaType == .image {
                if let strURL = editingInput?.fullSizeImageURL?.absoluteString {
                    print("IMAGE URL: ", strURL)
                } else {
                    print("nill")
                }
            }
        }
        asset.requestContentEditingInput(with: options) { (eidtingInput, info) in
            
            if #available(iOS 11.0, *) {
                let imgUrl = info[UIImagePickerController.InfoKey.imageURL] as? URL
            } else {
                // Fallback on earlier versions
            }
            print("Here")
    

    // print(imgUrl) print(info) print(eidtingInput)

          if let input = eidtingInput, let imgURL = input.fullSizeImageURL {
             // imgURL
            print(imgURL)
            finalURL = imgURL
          }
        }
        return finalURL
    }`
    
    opened by singh-karan-7 0
  • Library no work

    Library no work

    Fusuma not work multiply selected image in gallery, button done not get images. Error is in method

    private func requestImage(with asset: PHAsset, cropRect: CGRect, completion: @escaping (PHAsset, UIImage) -> Void) { DispatchQueue.global(qos: .default).async(execute: { let options = PHImageRequestOptions() options.deliveryMode = .highQualityFormat options.isNetworkAccessAllowed = true options.normalizedCropRect = cropRect options.resizeMode = .exact

            let targetWidth  = floor(CGFloat(asset.pixelWidth) * cropRect.width)
            let targetHeight = floor(CGFloat(asset.pixelHeight) * cropRect.height)
            let dimensionW   = max(min(targetHeight, targetWidth), 1024 * UIScreen.main.scale)
            let dimensionH   = dimensionW * self.getCropHeightRatio()
    
            let targetSize   = CGSize(width: dimensionW, height: dimensionH)
    
            PHImageManager.default().requestImage(for: asset, targetSize: targetSize, contentMode: .aspectFill, options: options) { result, info in
                guard let result = result else { return }
    
                DispatchQueue.main.async(execute: {
                    completion(asset, result)
                })
            }
        })
    }
    
    opened by cioletti 3
  • zoom in or zoom out  image in crop view increase collection view height

    zoom in or zoom out image in crop view increase collection view height

    when I am trying to zoom in or zoom out the image which is in crop view it scrolls up the collection view... this event increase the height of collection view..I want exact same as it works in Instagram..can you please help me to solve this issue

    opened by ritz122 0
  • Reload after auth given

    Reload after auth given

    On iOS 13, after permission is given for camera and library fusma is still blank. The user has to click out and back in before the images show.

    Any way to solve this?

    opened by paulsUsername 4
  • Memory leak issue

    Memory leak issue

    While selecting more than 15 images, it will crash the app due to memory issue. Even in your example demo you can check the same with uploading 15 or more photos.

    Screenshot 2019-07-12 at 1 50 09 PM

    opened by dhara6894 0
Releases(1.1.1)
Owner
Yuta Akizuki
Yuta Akizuki
Library for iOS Camera API. CameraKit helps you add reliable camera to your app quickly.

CameraKit helps you add reliable camera to your app quickly. Our open source camera platform provides consistent capture results, service that scales, and endless camera possibilities.

CameraKit 628 Dec 27, 2022
iOS camera engine with Vine-like tap to record, animatable filters, slow motion, segments editing

SCRecorder A Vine/Instagram like audio/video recorder and filter framework in Objective-C. In short, here is a short list of the cool things you can d

Simon Corsin 3.1k Dec 25, 2022
BarcodeScanner is a simple and beautiful wrapper around the camera with barcode capturing functionality and a great user experience.

Description BarcodeScanner is a simple and beautiful wrapper around the camera with barcode capturing functionality and a great user experience. Barco

HyperRedink 1.6k Jan 7, 2023
NextLevel is a Swift camera system designed for easy integration, customized media capture, and image streaming in iOS

NextLevel is a Swift camera system designed for easy integration, customized media capture, and image streaming in iOS. Integration can optionally leverage AVFoundation or ARKit.

NextLevel 2k Jan 2, 2023
A camera designed in Swift for easily integrating CoreML models - as well as image streaming, QR/Barcode detection, and many other features

Would you like to use a fully-functional camera in an iOS application in seconds? Would you like to do CoreML image recognition in just a few more sec

David Okun 868 Dec 29, 2022
ALCameraViewController - A camera view controller with custom image picker and image cropping.

ALCameraViewController A camera view controller with custom image picker and image cropping. Features Front facing and rear facing camera Simple and c

Alex Littlejohn 2k Dec 6, 2022
This plugin defines a global navigator.camera object, which provides an API for taking pictures and for choosing images from the system's image library.

title description Camera Take pictures with the device camera. AppVeyor Travis CI cordova-plugin-camera This plugin defines a global navigator.camera

null 0 Nov 2, 2021
Custom camera with AVFoundation. Beautiful, light and easy to integrate with iOS projects.

?? Warning This repository is DEPRECATED and not maintained anymore. Custom camera with AVFoundation. Beautiful, light and easy to integrate with iOS

Tudo Gostoso Internet 1.4k Dec 16, 2022
A fully customisable and modern camera implementation for iOS made with AVFoundation.

Features Extremely simple and easy to use Controls autofocus & exposure Customizable interface Code-made UI assets that do not lose resolution quality

Gabriel Alvarado 1.3k Nov 30, 2022
Fasttt and easy camera framework for iOS with customizable filters

FastttCamera is a wrapper around AVFoundation that allows you to build your own powerful custom camera app without all the headaches of using AVFounda

IFTTT 1.8k Dec 10, 2022
An iOS framework that uses the front camera, detects your face and takes a selfie.

TakeASelfie An iOS framework that uses the front camera, detects your face and takes a selfie. This api opens the front camera and draws an green oval

Abdullah Selek 37 Jan 3, 2023
Simple Swift class to provide all the configurations you need to create custom camera view in your app

Camera Manager This is a simple Swift class to provide all the configurations you need to create custom camera view in your app. It follows orientatio

Imaginary Cloud 1.3k Dec 29, 2022
A light weight & simple & easy camera for iOS by Swift.

DKCamera Description A light weight & simple & easy camera for iOS by Swift. It uses CoreMotion framework to detect device orientation, so the screen-

Bannings 86 Aug 18, 2022
Camera engine for iOS, written in Swift, above AVFoundation. :monkey:

?? The most advanced Camera framework in Swift ?? CameraEngine is an iOS camera engine library that allows easy integration of special capture feature

Remi ROBERT 575 Dec 25, 2022
A Snapchat Inspired iOS Camera Framework written in Swift

Overview SwiftyCam is a a simple, Snapchat-style iOS Camera framework for easy photo and video capture. SwiftyCam allows users to capture both photos

Andrew Walz 2k Dec 21, 2022
Easily take a photo or video or choose from library

FDTake Easily take a photo or video or choose from library ?? Author's tip jar: https://amazon.com/hz/wishlist/ls/EE78A23EEGQB Usage To run the exampl

William Entriken 322 Nov 30, 2022
UIView+CameraBackground - Show camera layer as a background to any UIView.

UIView+CameraBackground Show camera layer as a background to any UIView. Features Both front and back camera supported. Flash modes: auto, on, off. Co

Yonat Sharon 63 Nov 15, 2022
A simple, customizable camera control - video recorder for iOS.

LLSimpleCamera: A simple customizable camera - video recorder control LLSimpleCamera is a library for creating a customized camera - video recorder sc

Ömer Faruk Gül 1.2k Dec 12, 2022
Mock UIImagePickerController for testing camera based UI in simulator

Mock UIImagePickerController to simulate the camera in iOS simulator.

Yonat Sharon 18 Aug 18, 2022