Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding willConfigure & didConfigure methodes to delegate #9

Open
Idomo opened this issue Jan 22, 2019 · 0 comments
Open

Adding willConfigure & didConfigure methodes to delegate #9

Idomo opened this issue Jan 22, 2019 · 0 comments

Comments

@Idomo
Copy link
Contributor

Idomo commented Jan 22, 2019

I accidentally open it on the wrong library, so here is the link to my issue: rzmn/CropView#10 (comment)
In short - I found solution for this issue, but it includes perform some operations after each time the function configure is called.
I've tried to add the delegate methods by myself (locally) and from some reason they didn't work, the methods aren't getting called.

May you'll be able to add those correctly?
Also, I tried to make those 2 new methods optional ('cause their not must), but couldn't done that.

public protocol DocumentCropViewControllerDelegate: class {

  func documentCropViewController(result: Result)
  func documentCropViewController(failed: Error)

  // New delegate methods
  func documentCropViewControllerWillConfigure()
  func documentCropViewControllerDidConfigure()

}
public func configure() {
    DispatchQueue.main.async { [weak self] in
      self?.cropDelegate?.documentCropViewControllerWillConfigure() // Call delegate before configure
    }
    image = image?.fixOrientation()
    imageView.transform = CGAffineTransform.identity
    imageView.image = image
    imageView.contentMode = .scaleAspectFit
    points = defaultCropViewCorners()

    guard let image = image else { return }
    rectangleDetector.detect(image: image, completion: handleDetection)
    DispatchQueue.main.async { [weak self] in
      self?.cropDelegate?.documentCropViewControllerDidConfigure() // Call delegate after configure
    }
}

Hope you'll be able to add those ASAP,
Ido.

Idomo added a commit to Idomo/SwiftDocumentScanner that referenced this issue Jan 23, 2019
Like I explained in jonasbeckers#9, I was able to make those work after running "Clean Build Folder" from "Product" menu in xCode.
- If you know how - you may want to make those 2 new methods optional, 'cause they're not must.
- If there is need for something like `DispatchQueue.global(qos: .userInitiated).async` that you've included in the other calls for the delegate methods, you may add it (I didn't know if this is related to the cropping itself or to the delegate methods).

Thanks,
Ido.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant