Giter Site home page Giter Site logo

ytakzk / fusuma Goto Github PK

View Code? Open in Web Editor NEW
2.5K 61.0 341.0 7.89 MB

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

License: MIT License

Swift 98.44% Ruby 1.00% Objective-C 0.56%
swift cocoapod cocoapods carthage photo-browser instagram crop ios video

fusuma's Introduction

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.

fusuma's People

Contributors

5d avatar ajijoyo avatar chrislowe-takor avatar dkcas11 avatar ferrick90 avatar gotokatsuya avatar johnson145 avatar kevinmann avatar korzonek avatar lexrus avatar mamouneyya avatar michaelbina avatar michaelhenry avatar mikemliu avatar mschettler avatar nkezhaya avatar papanton avatar peterek avatar praveenpendyala avatar pruthvikar avatar readmecritic avatar saugat135 avatar sergioutama avatar shrugs avatar stroboche avatar swarchen avatar sydneyitguy avatar thanhtranbbd avatar waterskier2007 avatar ytakzk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

fusuma's Issues

Save Taken Photo to Library

How can I do this? Something like

if let pickedImage = info[UIImagePickerControllerOriginalImage] as? UIImage {
      UIImageWriteToSavedPhotosAlbum(pickedImage, nil, nil, nil)
}

Have support obj-c?

Hi, firstly, your control is so great, it save my time. Have it support obj-c project?

Customizing Fusuma from objective-c project

Hi, I used Fusuma in my project written in objective-c, all works correct, but i have not access to local variables like fusumaTintColor or fusumaBackgroundColor. Can i customize Fusuma interface without changing source code in Fusuma lib?
Thanks:)

Localization

Hi

Thanks for the great work.

It would be great if your control was localized or localizable.

titleLabel.text = "CAMERA ROLL"
titleLabel.text = NSLocalizedString("CAMERA ROLL", comment: "CAMERA ROLL")

titleLabel.text = "PHOTO"
titleLabel.text = NSLocalizedString("PHOTO", comment: "PHOTO")

Kind Regards
Graham

Crash when remove the source file from library and open app

Steps to reproduce:

  1. Show picture library
  2. Choose one of the pictures (or keep the first one)
  3. Go to background mode
  4. Open picture library on your iPhone and remove the photo, that you selected in step 2
  5. Open app

Expected behavior: deleted photo should disappear from main image view
Actual behavior: app crashes when enter active mode

Swift 3

Do you plan to create a swift3 branch soon?

Close button and bottom button touches are delayed

In this new version with video included, there is issue with touches on close button and bottom buttons. tried different solutions, nothing worked. any idea how to make the button press smooth as like in the old version.?

Color Scheme

Hi

Thanks for the great work.

It would be great if your control would support a light color scheme in addition to the existing dark scheme.

Kind Regards
Graham

Question: Default camera?

How can I make the front facing camera the default camera to use? Right now its showing the camera on the back of the phone first. Thank you. I am liking this! :)

Map view

Hello

I am deeply looking for a tool that could display all my likes on a map (and not my own posts only as does ig right now)

Since your project seems to be the most active, I am putting this request here as an improvement. Maybe you could collaborate with this project to use Google Maps : https://github.com/haydenbleasel/photomap

Thank you for the attention you will give to my request ;)

Cheers

Torch mode in video instead of flash mode

Hi, I just found an issue with the torch mode of the camera when recording video. Currently in your code you're toggling flashMode of the device, which should be replaced with torchMode for the feature to work properly.

Anw, thanks for the library!

Video capture crash, reason flashMode

App crash when activating video capture mode

Device: iPad Air 2

FusumaExample[5376:2477109] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[AVCaptureVideoDevice setFlashMode:] - the passed flashMode 0 is not supported by the device. Use -isFlashModeSupported: to discover valid flash modes.'

clone the repository, add fusuma.hasVideo = true to ViewController.swift run the app

problem is FSVideoCameraView.swift, adding guard device.hasFlash else { return } before device.flashMode = AVCaptureFlashMode.Off fixes the crash but the flashButton is still in the UI and users can press it, that will make the app crash with the same error, in Picture mode flashButton is not displayed

iPad Landscape

Is it possible to change UX to use iPad in Landscape mode?

Impossible to load photos from gallery if "Optimize iPhone Storage" is selected

Hi and thanks for sharing this beautiful picker.
In my iPhone i have this: Settings->Photos & Camera->Optimise iPhone Storage
Lot of my photos are in low res loaded in iCloud, and with the standard picker they are downloaded from iCloud when selected.
With Fusuma picker if I pick up a photo from my gallery (and if the photo is a low res photo loaded in iCloud) the photo is not displayed.

support switch albums

Can add switch albums to select the photo? It will help end-user easier to search their photo.

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)

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

Record video in square

Is there any way i can record the video in square? fusumaCropImage just works for the image and not video

Return a PHAsset URL

It would be nice to get the PHAsset URL so that image info like location can be extracted.

Allow not cropped photos

Is it possible to not crop images picked from Fusuma? I love this controller but I need original images.

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 (Carthage/Carthage#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?

Disable Photo Library picker

Hi, love the camera, almost exactly what I was looking for!

I want to force my users to take a picture instead of being able to choose one from their photo library, is there a way to disable it and allow only camera mode?

Animation issue for select gallery photo cell

In FSAlbumView, once CollectionView didSelectItemAtIndexPath is calling and the main layout will change after collectionView will scrollToItemAtIndexPath. It make user see like a bit lagging. (sudden Down and Up) Hope can improve transition in future.

Crashes when tapping the camera preview for focus.

I could only reproduce the issue in Xcode 7.3.

Root of the problem that I found:

In FSCameraView when creating tapRecognizer for previewViewContainer the action for the gesture recognizer ie. "focus:" has not been given @objc attribute.

Not correctly image sizes

When i pick image from library its size like 400x400, and when i make photo its size like 3000x3000. Can you pls fix library image size to full?
2016-05-18 11 11 21

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.