-
Notifications
You must be signed in to change notification settings - Fork 68
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
modifying testing image protocol to return square and full-screen images #102
Conversation
Did not implement cropping the square in OCR to a credit card size yet since I want to get this portion done first. |
[RFC]
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good start, left a few comments
@@ -18,7 +19,7 @@ import Vision | |||
} | |||
|
|||
|
|||
@objc public weak var testingImageDataSource: TestingImageDataSource? | |||
public var testingImageDataSource: TestingImageDataSource? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we need to leave the weak
in here to avoid a memory leak, but I'm not 100% sure
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it wont let me put the weak
in there :-/ . i get the errors 'weak' must not be applied to non-class-bound 'TestingImageDataSource'
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should understand this more clearly. the "safe" thing to do here is to add the @objc and weak back and be done with it, but if you want to make a change it's going to require some deeper analysis
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
im going to see if theres a workaround in the next commit to just add the @objc back. it's all because of that optional return
I'll get on the end-end test once we approve the protocol design |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
More comments, looking better
@@ -18,7 +19,7 @@ import Vision | |||
} | |||
|
|||
|
|||
@objc public weak var testingImageDataSource: TestingImageDataSource? | |||
public var testingImageDataSource: TestingImageDataSource? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should understand this more clearly. the "safe" thing to do here is to add the @objc and weak back and be done with it, but if you want to make a change it's going to require some deeper analysis
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
More comments
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
More comments, getting closer. My last hesitation is around having a protocol that inherits from something -- it seems hacky.
|
||
if #available(iOS 11.2, *) { | ||
if self.scanQrCode { | ||
self.blockingQrModel(pixelBuffer: pixelBuffer) | ||
} else { | ||
self.blockingOcrModel(squareCardImage: squareCardImage, fullCardImage: fullCardImage) | ||
self.blockingOcrModel(squareCardImage: squareAndFullCardImage.0, fullCardImage: squareAndFullCardImage.1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
naming individual tuple elements here doesn't seem great people would need to know that .0 is square and .1 is full. For squareAndFullCardImage why not have variables directly, something like let (square, full) = self.testingImageDataSource...
@@ -521,7 +496,6 @@ import Vision | |||
let rect = CGRect(x: cx - width / 2.0, y: cy - height / 2.0, width: width, height: height) | |||
|
|||
self.currentImageRect = rect | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you remove whitespace changes from here and the few other places that they show up?
I would argue that its actually not hacky. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I stand corrected on protocols inheriting from AnyObject, looks good. #shipit
[RFC]
TestingImageDataSource
protocol implementercaptureOutputWork
checks: