Skip to content

Adding willConfigure & didConfigure methodes to delegate #9

@Idomo

Description

@Idomo

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions