WeTransfer / WeScan

Document Scanning Made Easy for iOS
MIT License
2.87k stars 561 forks source link

Cannot use framework because classes are not public #118

Closed winstonschen closed 4 years ago

winstonschen commented 5 years ago

I tried to use this as a Pod but use any of the classes because they're not declared public.

Boris-Em commented 5 years ago

Hi @winstonschen, ImageScannerController is the main class you should be interacting with and should be declared public. Can you check that it's the case for you?

winstonschen commented 5 years ago

Yes, ImageScannerController is indeed public. But I'm building a bunch of features specific to my product and need more fine grained control. (For example, a rapid scanning mode that skips cropping and allow for scanning multiple pages rapidly to create a multi-page document.) In effect I'm writing my own ScannerViewController, EditViewController, and ImageScannerController. I love that WeScan encapsulates many of the details for using the camera as well as cropping, etc. which is why I jumped onboard to use it. And I suspect there're more people in my boat.

Boris-Em commented 5 years ago

Thanks for the clarification @winstonschen. That's indeed a good point. Our framework is not generic at all, and is very hard to use outside of our specific use cases. Do you have any suggestions as to how we could do so?

winstonschen commented 5 years ago

It's already working reasonably well after I made some of the properties and methods public.

Off the top of my head:

  1. Make all properties and methods that can potentially be used outside of the classes/structs public
  2. Create a class (say, ScannedPage) that encapsulates data of a captured image which includes original image, quad, cropped image, enhanced image and implement a proper image processing pipeline in that class. Again, app developers can subclass it to customize behavior such as post processing, etc.
  3. Create an UIView for only the photo/video capture area. That way we can subclass that UIView to customize behavior.
  4. Create a single zoomable UIScrollView that displays a ScannedPage with editable quadView and the image which is optionally enhanced. Provide transformation methods so we can display additional objects as subviews on top of the image.
  5. Do not use UINavigationController -- leave navigation to the app developer.
  6. Add more fine grained controls 6a. Make orientation detection using CoreMotion optional 6b. Make aspect ratio (fill vs. fit) of the video view a parameter
  7. Prefix all classes with "WS"
  8. All instances of Quadrilateral should be in image coordinates. It's up to the UIViews that display them to perform transformations.

Of course we should keep ScannerViewController, EditScanViewController and ReviewViewController as examples that app developers can use as starting points. But they should not be in the framework.

Sorry for the very long dump... I'm fairly new to contributing to OpenSource and apologize for violating unspoken etiquettes.

AvdLee commented 5 years ago

@winstonschen we would be open to making the framework more flexible. Would you have the time to implement your suggestion in a pull request?

Might be good to start with the bare minimum, making some of the classes open instead of public, allowing you to adjust accordingly.

Let me know your thoughts!

julianschiavo commented 5 years ago

If it helps some of this is already in the under review PR #138

winstonschen commented 5 years ago

I would be glad to and I can start in a week after I finish an app release. By the way, I've already made significant modifications to this framework and would be happy to contribute.

240987 commented 5 years ago

Is this done? I wanted to use the classes in my app but not able to use it.

github-actions[bot] commented 4 years ago

This issue is stale because it has been open for 30 days with no activity. Remove the Stale label or comment or this will be closed in 10 days.