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

Last update: Aug 3, 2022

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.

GitHub

https://github.com/ytakzk/Fusuma
Comments
  • 1. 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 :/

    Reviewed by sebastienboulogne at 2016-09-16 12:53
  • 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

    Reviewed by leapfrog-saugat at 2016-03-28 05:37
  • 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 ??

    Reviewed by billionbucks at 2016-09-19 20:01
  • 4. 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)
    
    Reviewed by shakked at 2016-06-28 16:02
  • 5. 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.

    Reviewed by ghysrc at 2016-02-17 06:49
  • 6. 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

    Reviewed by anitalanet at 2017-03-21 10:48
  • 7. 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.

    Reviewed by melancholy13 at 2019-01-04 13:21
  • 8. 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

    Reviewed by Bomiishere at 2017-04-30 18:40
  • 9. #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.

    Reviewed by rstewart22 at 2018-07-20 10:47
  • 10. 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
    
    Reviewed by thyselius at 2016-10-30 19:20
  • 11. 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?

    Reviewed by rodrigoruiz at 2016-07-27 06:27
  • 12. 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
    }`
    
    Reviewed by singh-karan-7 at 2019-12-21 09:39
  • 13. 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)
                })
            }
        })
    }
    
    Reviewed by cioletti at 2019-10-09 16:29
  • 14. 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

    Reviewed by ritz122 at 2019-10-05 04:21
  • 15. 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?

    Reviewed by paulsUsername at 2019-09-29 22:32
  • 16. 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

    Reviewed by dhara6894 at 2019-07-12 08:23
A camera view controller with custom image picker and image cropping.
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

Aug 3, 2022
Library for iOS Camera API. Massively increase performance and ease of use within your next iOS Project.
Library for iOS Camera API. Massively increase performance and ease of use within your next iOS Project.

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

Aug 3, 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

Aug 3, 2022
A better way to operate QR Code in Swift, support iOS, macOS, watchOS and tvOS.
A better way to operate QR Code in Swift, support iOS, macOS, watchOS and tvOS.

EFQRCode is a lightweight, pure-Swift library for generating stylized QRCode images with watermark or icon, and for recognizing QRCode from images, in

Aug 1, 2022
You will learn how to scan QR code with iOS framework.
You will learn how to scan QR code with iOS framework.

QR Code Scanner You will learn how to scan QR code with in iOS without using any library. It is as simple to scan QR code in iOS. In this example, We

Jun 20, 2022
Swift library to easily check the current device and some more info about it.
Swift library to easily check the current device and some more info about it.

Usage To run the example project, clone the repo, and run pod install from the Example directory first. let device = Deviice.current device is a Devi

Apr 19, 2022
Light weight tool for detecting the current device and screen size written in swift.
Light weight tool for detecting the current device and screen size written in swift.

Device detect the current  device model and screen size. Installation CocoaPods Device is available through CocoaPods. To install it, simply add the

Jul 18, 2022
🛰 CoreLocation Made Easy - Efficient & Easy Location Tracker, IP Location, Gecoder, Geofence, Autocomplete, Beacon Ranging, Broadcaster and Visits Monitoring
🛰 CoreLocation Made Easy - Efficient & Easy Location Tracker, IP Location, Gecoder, Geofence, Autocomplete, Beacon Ranging, Broadcaster and Visits Monitoring

Location Manager Made Easy SwiftLocation is a lightweight Swift Library that provides an easy way to work with location-related functionalities. No mo

Aug 10, 2022
:mag_right: A simple and beautiful barcode scanner.
:mag_right: A simple and beautiful barcode scanner.

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

Aug 3, 2022
Simply the fastest way to transmit data between iOS/tvOS and OSX

DarkLightning DarkLightning is a lightweight Swift library to allow data transmission between iOS/tvOS devices (Lightning port, Dock connector, USB-C)

Jul 31, 2022
Luminous provides you a lot of information about the system and a lot of handy methods to quickly get useful data on the iOS platform.
Luminous provides you a lot of information about the system and a lot of handy methods to quickly get useful data on the iOS platform.

Luminous Example To run the example project, clone the repo, and run pod install from the Example directory first. Requirements iOS 8+ Swift 5 Xcode 1

Jul 15, 2022
WatchCon is a tool which enables creating easy connectivity between iOS and WatchOS.
WatchCon is a tool which enables creating easy connectivity between iOS and WatchOS.

WatchCon WatchCon is a tool which enables creating easy connectivity between iOS and WatchOS Requirements iOS 9.0+ / watchOS 2.0+ CocoaPods CocoaPods

Jun 18, 2022
NFC Forum Well Known Type Data Parser for iOS11 and Core NFC

NFCNDEFParse NFC Forum Well Known Type Data Parser for iOS11 and Core NFC. Supports parsing of types: Text - NFCForum-TS-RTD_Text_1.0 2006-07-24 Uri -

Jul 21, 2021
Lightweight Cocoa library for detecting the running device's model and screen size.
Lightweight Cocoa library for detecting the running device's model and screen size.

Lightweight Cocoa library for detecting the running device's model and screen size. With the newer  devices, developers have more work to do. This li

Jul 1, 2022
⬆️ Rad Media Capture in Swift
⬆️ Rad Media Capture in Swift

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

Aug 4, 2022
Simple QRCode reader in Swift
Simple QRCode reader in Swift

QRCodeReader.swift is a simple code reader (initially only QRCode) for iOS in Swift. It is based on the AVFoundation framework from Apple in order to

Aug 3, 2022
A simple Swift framework for building reliable Bluetooth LE apps.
A simple Swift framework for building reliable Bluetooth LE apps.

Bluejay is a simple Swift framework for building reliable Bluetooth LE apps. Bluejay's primary goals are: Simplify talking to a single Bluetooth LE pe

Jul 12, 2022
Demo using Terminal.Gui with Llama Swift
Demo using Terminal.Gui with Llama Swift

Hola! This repo is a demo which shows the use of Llama Swift with Terminal.Gui. Llama is my exploratory project to compile "other languages" for .NET

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

NOTE: This project is no longer maintained. We highly recommend YPImagePicker. Fusuma Fusuma is a Swift library that provides an Instagram-like photo

Aug 3, 2022
A photo gallery for iOS with a modern feature set. Similar features as the Facebook photo browser.
A photo gallery for iOS with a modern feature set. Similar features as the Facebook photo browser.

EBPhotoPages ”A photo gallery can become a pretty complex component of an app very quickly. The EBPhotoPages project demonstrates how a developer coul

Jun 30, 2022