avito-tech / Paparazzo

Custom iOS camera and photo picker with editing capabilities
MIT License
779 stars 82 forks source link

The passing images #6

Closed jackpaster closed 7 years ago

jackpaster commented 7 years ago

@prn @limarc @eshkinkot @dkostyrev @lahmatiy thanks for helping me out last type with the storyboard example but two more questions. Is there anyway to access the images taken by the camera because I plan on passing them to a new view controller

lahmatiy commented 7 years ago

@jackpaster Please, don't mention random persons in your comments. Some of them (like me) doesn't relate to this project. More over maintainers and watchers recieve notifications even without mentioning. Thank you.

HiveHicks commented 7 years ago

@jackpaster You can set module's onFinish closure in module configuration block. This closure has a parameter which is an array of selected MediaPickerItems. You can see the example in https://github.com/avito-tech/Paparazzo/blob/master/Example/PaparazzoExample/Example/Presenter/ExamplePresenter.swift (lines 53-56):

module.onFinish = { [weak module] items in
    debugPrint("media picker did finish with \(items.count) items:")
    items.forEach { debugPrint($0) }
    self?.items = items
    ...

Thanks for pointing this out. I'll fix the documentation soon.

jackpaster commented 7 years ago

Sorry

On Monday, March 6, 2017, Roman Dvornov notifications@github.com wrote:

@jackpaster https://github.com/jackpaster Please, don't mention random persons in your comments. Some of them (like me) doesn't relate to this project. More over maintainers and watchers recieve notifications even without mentioning. Thank you.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/avito-tech/Paparazzo/issues/6#issuecomment-284390888, or mute the thread https://github.com/notifications/unsubscribe-auth/ARCMmT2hy4j3fWtYUre0BT_VOmXRaAknks5rjATkgaJpZM4MUHgu .

jackpaster commented 7 years ago

@HiveHicks now I want to have three of these cameras in three different storyboards. Do I have to have three different examplepresenter view controller. One for each camera. And if so, what other view controllers need to be multiplied for each individual camera

HiveHicks commented 7 years ago

@jackpaster First of all, you don't have to use Presenter at all. PaparazzoExample is written using VIPER architecture, that's why it has Presenter, Router, Interactor and other stuff. You don't need all that. You just need to create Paparazzo's view controller like you create any other view controller programmatically. The only difference is that you don't create it with typical UIViewController's initializer, but rather using AssemblyFactory:

let factory = Paparazzo.AssemblyFactory()
let assembly = factory.mediaPickerAssembly()

let viewController = assembly.module(
    items: items,
    selectedItem: selectedItem,
    maxItemsCount: maxItemsCount,
    cropEnabled: true,
    cropCanvasSize: cropCanvasSize,
    configuration: { module in
        module.onFinish = { [weak module] photos in
            // do whatever you want with photos
            module?.dismissModule()
        }
        module.onCancel = { [weak module] in
            module?.dismissModule()
        }
    }
)

Perhaps we would add some component to simplify using Paparazzo from storyboard so that you don't have to write any code. I'll do a research.

jackpaster commented 7 years ago

@HiveHicks I'm having a hard time just using This without viper architecture. Could you possible edit the existing storyboard project to work from a regular uiviewcontroller without viper architecture. Thank you.

On Monday, March 6, 2017, Andrey Yutkin notifications@github.com wrote:

@jackpaster https://github.com/jackpaster First of all, you don't have to use Presenter at all. PaparazzoExample is written using VIPER architecture, that's why it has Presenter, Router, Interactor and other stuff. You don't need all that. You just need to create Paparazzo's view controller like you create any other view controller programmatically. The only difference is that you don't create it with typical UIViewController's initializer, but rather using AssemblyFactory:

let factory = Paparazzo.AssemblyFactory() let assembly = factory.mediaPickerAssembly()

let viewController = assembly.module( items: items, selectedItem: selectedItem, maxItemsCount: maxItemsCount, cropEnabled: true, cropCanvasSize: cropCanvasSize, configuration: { module in module.onFinish = { [weak module] photos in // do whatever you want with photos module?.dismissModule() } module.onCancel = { [weak module] in module?.dismissModule() } } )

Perhaps we would add some component to simplify using Paparazzo from storyboard so that you don't have to write any code. I'll do a research.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/avito-tech/Paparazzo/issues/6#issuecomment-284397519, or mute the thread https://github.com/notifications/unsubscribe-auth/ARCMmZTXPZ9EnqCTHoOtuoDzTTvMiH4Aks5rjAwVgaJpZM4MUHgu .

jackpaster commented 7 years ago

@HiveHicks i have a contstruction app and at the end after filling in all the information A user will click a button and take pictures of the construction site and then when they finish there will be a preview where the user can view all the images and scroll threw them and view the information they filled in before. I've done this all in storyboards and this project is great for that. That's why I asked you to use storyboards. But I think it will be hard to implement with viper arcticeture. So if you could show me how to implement it all with one view controller in one storyboard without presenters, etc. I would really appreciate it. Thanks for all your help

jackpaster commented 7 years ago

What do you think

On Monday, March 6, 2017, jack paster jackpaster22@gmail.com wrote:

I'm having a hard time just using This without viper architecture. Could you possible edit the existing storyboard project to work from a regular uiviewcontroller without viper architecture. Thank you.

On Monday, March 6, 2017, Andrey Yutkin <notifications@github.com javascript:_e(%7B%7D,'cvml','notifications@github.com');> wrote:

@jackpaster https://github.com/jackpaster First of all, you don't have to use Presenter at all. PaparazzoExample is written using VIPER architecture, that's why it has Presenter, Router, Interactor and other stuff. You don't need all that. You just need to create Paparazzo's view controller like you create any other view controller programmatically. The only difference is that you don't create it with typical UIViewController's initializer, but rather using AssemblyFactory:

let factory = Paparazzo.AssemblyFactory() let assembly = factory.mediaPickerAssembly()

let viewController = assembly.module( items: items, selectedItem: selectedItem, maxItemsCount: maxItemsCount, cropEnabled: true, cropCanvasSize: cropCanvasSize, configuration: { module in module.onFinish = { [weak module] photos in // do whatever you want with photos module?.dismissModule() } module.onCancel = { [weak module] in module?.dismissModule() } } )

Perhaps we would add some component to simplify using Paparazzo from storyboard so that you don't have to write any code. I'll do a research.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/avito-tech/Paparazzo/issues/6#issuecomment-284397519, or mute the thread https://github.com/notifications/unsubscribe-auth/ARCMmZTXPZ9EnqCTHoOtuoDzTTvMiH4Aks5rjAwVgaJpZM4MUHgu .

HiveHicks commented 7 years ago

@jackpaster I will have time for that in an hour or two. I'll let you know when it's ready.

jackpaster commented 7 years ago

Thank you

On Monday, March 6, 2017, Andrey Yutkin notifications@github.com wrote:

@jackpaster https://github.com/jackpaster I will have time for that in an hour or two. I'll let you know when it' ready.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/avito-tech/Paparazzo/issues/6#issuecomment-284471536, or mute the thread https://github.com/notifications/unsubscribe-auth/ARCMmT6SJpiw7tK3GjQ09xpQRrI8au9Eks5rjERLgaJpZM4MUHgu .

HiveHicks commented 7 years ago

@jackpaster I've slightly modified an example. Now it displays the first photo picked via Paparazzo in image view of ViewController that presents it. If you need to display an array of ImageSource in collection view, there's UIImageSourceCollectionViewCell that you can use for that. More info on ImageSource is coming (#3).

See d928aecf121a24ef3fc8acc900dd6e89cf8618d2 and 6d7a19c7d7cdedb4b1c92ef7a4c4ed766081b5fe

Ahmedshubber commented 7 years ago

@HiveHicks How can I access all the images in "let Photos = [ImageSource]". Im passing images to a new view controller and i need to access all the photos in Photos. How can I do that. thats my last problem and I will be done. This project is great by the way!

jackpaster commented 7 years ago

@HiveHicks what do you think

HiveHicks commented 7 years ago

@Ahmedshubber I'm not sure what you're trying to do with photos. I recently added documentation section about ImageSource here. It should help.

jackpaster commented 7 years ago

@HiveHicks after I've taken and edited all the images. I want to go to a preview view controller or another view controller with an image slider. I already have the slider and how I get the images from the camera view controller to the preview or next view controller is to pass the images through a segue. No in order to pass the images. I have to access all uiimages from imagesource. I get a crash if I declare to pass imagesource because image source is an array. What is the code to access all uiimages from the imagesource. You showed me how to access the first image as photos.first. Is there something like photos.all where I can access all uiimages from imagesource. That's what I'm trying to accomplish.

jackpaster commented 7 years ago

@HiveHicks you say the easiest method is to access the first parameter in image source. How can I access all parameters in imagesource

jackpaster commented 7 years ago

What do you think

On Thursday, March 16, 2017, Andrey Yutkin notifications@github.com wrote:

@Ahmedshubber https://github.com/Ahmedshubber I'm not sure what you're trying to do with photos. I recently added documentation section about ImageSource here https://github.com/avito-tech/Paparazzo/tree/develop#ImageSource. It should help.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/avito-tech/Paparazzo/issues/6#issuecomment-287050306, or mute the thread https://github.com/notifications/unsubscribe-auth/ARCMmaD4pjG23m7WkVNoTiaMDwq1eIU5ks5rmTNmgaJpZM4MUHgu .

jackpaster commented 7 years ago

@HiveHicks I'll pay you 10$ if you can help me on upwork

jackpaster commented 7 years ago

I won't use PayPal because of the transaction fees

HiveHicks commented 7 years ago

You showed me how to access the first image as photos.first. Is there something like photos.all

You can iterate an array using forEach function: https://developer.apple.com/reference/swift/array/1689783-foreach

Ahmedshubber commented 7 years ago

Can you help me if I pay you

On Thursday, March 16, 2017, Andrey Yutkin notifications@github.com wrote:

You showed me how to access the first image as photos.first. Is there something like photos.all

You can iterate an array using forEach function: https://developer.apple.com/reference/swift/array/1689783-foreach

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/avito-tech/Paparazzo/issues/6#issuecomment-287098064, or mute the thread https://github.com/notifications/unsubscribe-auth/AOS4XrS5UjCi7i0pTCl93htHBoK8iQeBks5rmVgagaJpZM4MUHgu .

etolstoy commented 7 years ago

@jackpaster @Ahmedshubber Thanks for your interest in our project! We're happy that Paparazzo helps you.

However, we use GitHub Issues only for tracking bugs and enhancements. If you have any general programming questions - feel free to ask them on StackOverflow. If you'll have any questions about Paparazzo - add a corresponding tag in your question and we'll try to answer it (for free, we don't take money for our open source projects).