From 8aa4c1bcc90a7438099043fc62ebc68dcfb196ff Mon Sep 17 00:00:00 2001 From: Valeriy Van Date: Mon, 19 Jun 2023 15:21:39 +0300 Subject: [PATCH 01/12] Fix typo --- Sources/WeScan/Common/EditScanCornerView.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/WeScan/Common/EditScanCornerView.swift b/Sources/WeScan/Common/EditScanCornerView.swift index 42ac43b9..fcade9fa 100644 --- a/Sources/WeScan/Common/EditScanCornerView.swift +++ b/Sources/WeScan/Common/EditScanCornerView.swift @@ -26,7 +26,7 @@ final class EditScanCornerView: UIView { return layer }() - /// Set stroke color of coner layer + /// Set stroke color of corner layer public var strokeColor: CGColor? { didSet { circleLayer.strokeColor = strokeColor From e054a5687c032075da63bfa7806d96212825579c Mon Sep 17 00:00:00 2001 From: Valeriy Van Date: Mon, 19 Jun 2023 15:22:02 +0300 Subject: [PATCH 02/12] Fix typos --- Sources/WeScan/Common/Error.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Sources/WeScan/Common/Error.swift b/Sources/WeScan/Common/Error.swift index f0ddf449..797e22b2 100644 --- a/Sources/WeScan/Common/Error.swift +++ b/Sources/WeScan/Common/Error.swift @@ -13,9 +13,9 @@ import Foundation public enum ImageScannerControllerError: Error { /// The user didn't grant permission to use the camera. case authorization - /// An error occured when setting up the user's device. + /// An error occurred when setting up the user's device. case inputDevice - /// An error occured when trying to capture a picture. + /// An error occurred when trying to capture a picture. case capture /// Error when creating the CIImage. case ciImageCreation From 569357d018f9d0f579ad8c7fede16598fb70c26e Mon Sep 17 00:00:00 2001 From: Valeriy Van Date: Mon, 19 Jun 2023 15:23:05 +0300 Subject: [PATCH 03/12] Fix typos --- Sources/WeScan/Common/Quadrilateral.swift | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Sources/WeScan/Common/Quadrilateral.swift b/Sources/WeScan/Common/Quadrilateral.swift index e46cd918..ff9d2b0f 100644 --- a/Sources/WeScan/Common/Quadrilateral.swift +++ b/Sources/WeScan/Common/Quadrilateral.swift @@ -91,7 +91,7 @@ public struct Quadrilateral: Transformable { return quadrilateral } - /// Checks whether the quadrilateral is withing a given distance of another quadrilateral. + /// Checks whether the quadrilateral is within a given distance of another quadrilateral. /// /// - Parameters: /// - distance: The distance (threshold) to use for the condition to be met. @@ -122,7 +122,7 @@ public struct Quadrilateral: Transformable { return true } - /// Reorganizes the current quadrilateal, making sure that the points are at their appropriate positions. + /// Reorganizes the current quadrilateral, making sure that the points are at their appropriate positions. /// For example, it ensures that the top left point is actually the top and left point point of the quadrilateral. mutating func reorganize() { let points = [topLeft, topRight, bottomRight, bottomLeft] @@ -148,7 +148,7 @@ public struct Quadrilateral: Transformable { bottomLeft = xSortedBottomMostPoints[0] } - /// Scales the quadrilateral based on the ratio of two given sizes, and optionaly applies a rotation. + /// Scales the quadrilateral based on the ratio of two given sizes, and optionally applies a rotation. /// /// - Parameters: /// - fromSize: The size the quadrilateral is currently related to. @@ -193,7 +193,7 @@ public struct Quadrilateral: Transformable { /// Sorts the given `CGPoints` based on their y value. /// - Parameters: - /// - points: The poinmts to sort. + /// - points: The points to sort. /// - Returns: The points sorted based on their y value. private func sortPointsByYValue(_ points: [CGPoint]) -> [CGPoint] { return points.sorted { point1, point2 -> Bool in @@ -218,7 +218,7 @@ extension Quadrilateral { /// /// - Parameters: /// - height: The height of the rect containing the quadrilateral. - /// - Returns: The same quadrilateral in the cartesian corrdinate system. + /// - Returns: The same quadrilateral in the cartesian coordinate system. func toCartesian(withHeight height: CGFloat) -> Quadrilateral { let topLeft = self.topLeft.cartesian(withHeight: height) let topRight = self.topRight.cartesian(withHeight: height) From fd6f61fe572c19a2e7f0e2d56a0a5aef9e769169 Mon Sep 17 00:00:00 2001 From: Valeriy Van Date: Mon, 19 Jun 2023 15:23:46 +0300 Subject: [PATCH 04/12] Fix local var name --- Sources/WeScan/Common/Quadrilateral.swift | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Sources/WeScan/Common/Quadrilateral.swift b/Sources/WeScan/Common/Quadrilateral.swift index ff9d2b0f..dfa9ed73 100644 --- a/Sources/WeScan/Common/Quadrilateral.swift +++ b/Sources/WeScan/Common/Quadrilateral.swift @@ -156,16 +156,16 @@ public struct Quadrilateral: Transformable { /// - rotationAngle: The optional rotation to apply. /// - Returns: The newly scaled and potentially rotated quadrilateral. func scale(_ fromSize: CGSize, _ toSize: CGSize, withRotationAngle rotationAngle: CGFloat = 0.0) -> Quadrilateral { - var invertedfromSize = fromSize + var invertedFromSize = fromSize let rotated = rotationAngle != 0.0 if rotated && rotationAngle != CGFloat.pi { - invertedfromSize = CGSize(width: fromSize.height, height: fromSize.width) + invertedFromSize = CGSize(width: fromSize.height, height: fromSize.width) } var transformedQuad = self - let invertedFromSizeWidth = invertedfromSize.width == 0 ? .leastNormalMagnitude : invertedfromSize.width - let invertedFromSizeHeight = invertedfromSize.height == 0 ? .leastNormalMagnitude : invertedfromSize.height + let invertedFromSizeWidth = invertedFromSize.width == 0 ? .leastNormalMagnitude : invertedFromSize.width + let invertedFromSizeHeight = invertedFromSize.height == 0 ? .leastNormalMagnitude : invertedFromSize.height let scaleWidth = toSize.width / invertedFromSizeWidth let scaleHeight = toSize.height / invertedFromSizeHeight From 0359699cf3be0ac425fe7cf8d16f4e9f7e419cdf Mon Sep 17 00:00:00 2001 From: Valeriy Van Date: Mon, 19 Jun 2023 15:24:15 +0300 Subject: [PATCH 05/12] Fix doc comment --- Sources/WeScan/Common/VisionRectangleDetector.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/WeScan/Common/VisionRectangleDetector.swift b/Sources/WeScan/Common/VisionRectangleDetector.swift index f8c81b35..9cf57f19 100644 --- a/Sources/WeScan/Common/VisionRectangleDetector.swift +++ b/Sources/WeScan/Common/VisionRectangleDetector.swift @@ -10,7 +10,7 @@ import CoreImage import Foundation import Vision -/// Class used to detect rectangles from an image. +/// Enum encapsulating static functions to detect rectangles from an image. @available(iOS 11.0, *) enum VisionRectangleDetector { From 7c84dc5080f90400b8a29c13c8b97a822a1a7c20 Mon Sep 17 00:00:00 2001 From: Valeriy Van Date: Mon, 19 Jun 2023 15:24:35 +0300 Subject: [PATCH 06/12] Fix typo in assertion message --- Sources/WeScan/Extensions/CGImagePropertyOrientation.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/WeScan/Extensions/CGImagePropertyOrientation.swift b/Sources/WeScan/Extensions/CGImagePropertyOrientation.swift index 9de2634d..64a1c7fd 100644 --- a/Sources/WeScan/Extensions/CGImagePropertyOrientation.swift +++ b/Sources/WeScan/Extensions/CGImagePropertyOrientation.swift @@ -29,7 +29,7 @@ extension CGImagePropertyOrientation { case .rightMirrored: self = .rightMirrored @unknown default: - assertionFailure("Unknow orientation, falling to default") + assertionFailure("Unknown orientation, falling to default") self = .right } } From 3c28c4d6aced465e51dd606f871f468093957eee Mon Sep 17 00:00:00 2001 From: Valeriy Van Date: Mon, 19 Jun 2023 15:24:57 +0300 Subject: [PATCH 07/12] Fix typos --- Sources/WeScan/Extensions/CGPoint+Utils.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Sources/WeScan/Extensions/CGPoint+Utils.swift b/Sources/WeScan/Extensions/CGPoint+Utils.swift index c0a0766c..4176a18f 100644 --- a/Sources/WeScan/Extensions/CGPoint+Utils.swift +++ b/Sources/WeScan/Extensions/CGPoint+Utils.swift @@ -11,11 +11,11 @@ import UIKit extension CGPoint { - /// Returns a rectangle of a given size surounding the point. + /// Returns a rectangle of a given size surrounding the point. /// /// - Parameters: /// - size: The size of the rectangle that should surround the points. - /// - Returns: A `CGRect` instance that surrounds this instance of `CGpoint`. + /// - Returns: A `CGRect` instance that surrounds this instance of `CGPoint`. func surroundingSquare(withSize size: CGFloat) -> CGRect { return CGRect(x: x - size / 2.0, y: y - size / 2.0, width: size, height: size) } From 866576366776b0f78c4e01a995d21d21cfef6e32 Mon Sep 17 00:00:00 2001 From: Valeriy Van Date: Mon, 19 Jun 2023 15:25:25 +0300 Subject: [PATCH 08/12] Fix typo --- Sources/WeScan/Extensions/UIImage+Orientation.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/WeScan/Extensions/UIImage+Orientation.swift b/Sources/WeScan/Extensions/UIImage+Orientation.swift index 2283e94b..5b5154de 100644 --- a/Sources/WeScan/Extensions/UIImage+Orientation.swift +++ b/Sources/WeScan/Extensions/UIImage+Orientation.swift @@ -40,7 +40,7 @@ extension UIImage { /// - Parameters: /// - rotationAngle: The angle to rotate the image by. /// - options: Options to apply to the image. - /// - Returns: The new image rotated and optentially flipped (@see options). + /// - Returns: The new image rotated and optionally flipped (@see options). func rotated(by rotationAngle: Measurement, options: RotationOptions = []) -> UIImage? { guard let cgImage = self.cgImage else { return nil } From 49d96e1d930b75e6b6a1a27727eea1843456cec7 Mon Sep 17 00:00:00 2001 From: Valeriy Van Date: Mon, 19 Jun 2023 15:25:45 +0300 Subject: [PATCH 09/12] Fix typo --- Sources/WeScan/Review/ReviewViewController.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/WeScan/Review/ReviewViewController.swift b/Sources/WeScan/Review/ReviewViewController.swift index 2aabffb5..4608c23e 100644 --- a/Sources/WeScan/Review/ReviewViewController.swift +++ b/Sources/WeScan/Review/ReviewViewController.swift @@ -9,7 +9,7 @@ import UIKit /// The `ReviewViewController` offers an interface to review the image after it -/// has been cropped and deskwed according to the passed in quadrilateral. +/// has been cropped and deskewed according to the passed in quadrilateral. final class ReviewViewController: UIViewController { private var rotationAngle = Measurement(value: 0, unit: .degrees) From 4faff37cf335d79d338f31019169c24bdb2dc278 Mon Sep 17 00:00:00 2001 From: Valeriy Van Date: Mon, 19 Jun 2023 15:26:01 +0300 Subject: [PATCH 10/12] Fix typo --- Sources/WeScan/Scan/CaptureSessionManager.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/WeScan/Scan/CaptureSessionManager.swift b/Sources/WeScan/Scan/CaptureSessionManager.swift index 366a7067..d0ae615e 100644 --- a/Sources/WeScan/Scan/CaptureSessionManager.swift +++ b/Sources/WeScan/Scan/CaptureSessionManager.swift @@ -39,7 +39,7 @@ protocol RectangleDetectionDelegateProtocol: NSObjectProtocol { withQuad quad: Quadrilateral? ) - /// Called when an error occured with the capture session manager. + /// Called when an error occurred with the capture session manager. /// - Parameters: /// - captureSessionManager: The `CaptureSessionManager` that encountered an error. /// - error: The encountered error. From e9d712bf8b2085adf521f1f9150e6211a6989913 Mon Sep 17 00:00:00 2001 From: Valeriy Van Date: Mon, 19 Jun 2023 15:26:31 +0300 Subject: [PATCH 11/12] Fix typo in var names --- Sources/WeScan/Scan/ShutterButton.swift | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/Sources/WeScan/Scan/ShutterButton.swift b/Sources/WeScan/Scan/ShutterButton.swift index 872c3da1..a77abf78 100644 --- a/Sources/WeScan/Scan/ShutterButton.swift +++ b/Sources/WeScan/Scan/ShutterButton.swift @@ -11,10 +11,10 @@ import UIKit /// A simple button used for the shutter. final class ShutterButton: UIControl { - private let outterRingLayer = CAShapeLayer() + private let outerRingLayer = CAShapeLayer() private let innerCircleLayer = CAShapeLayer() - private let outterRingRatio: CGFloat = 0.80 + private let outerRingRatio: CGFloat = 0.80 private let innerRingRatio: CGFloat = 0.75 private let impactFeedbackGenerator = UIImpactFeedbackGenerator(style: .light) @@ -31,7 +31,7 @@ final class ShutterButton: UIControl { override init(frame: CGRect) { super.init(frame: frame) - layer.addSublayer(outterRingLayer) + layer.addSublayer(outerRingLayer) layer.addSublayer(innerCircleLayer) backgroundColor = .clear isAccessibilityElement = true @@ -48,11 +48,11 @@ final class ShutterButton: UIControl { override func draw(_ rect: CGRect) { super.draw(rect) - outterRingLayer.frame = rect - outterRingLayer.path = pathForOutterRing(inRect: rect).cgPath - outterRingLayer.fillColor = UIColor.white.cgColor - outterRingLayer.rasterizationScale = UIScreen.main.scale - outterRingLayer.shouldRasterize = true + outerRingLayer.frame = rect + outerRingLayer.path = pathForOuterRing(inRect: rect).cgPath + outerRingLayer.fillColor = UIColor.white.cgColor + outerRingLayer.rasterizationScale = UIScreen.main.scale + outerRingLayer.shouldRasterize = true innerCircleLayer.frame = rect innerCircleLayer.path = pathForInnerCircle(inRect: rect).cgPath @@ -85,10 +85,10 @@ final class ShutterButton: UIControl { // MARK: - Paths - private func pathForOutterRing(inRect rect: CGRect) -> UIBezierPath { + private func pathForOuterRing(inRect rect: CGRect) -> UIBezierPath { let path = UIBezierPath(ovalIn: rect) - let innerRect = rect.scaleAndCenter(withRatio: outterRingRatio) + let innerRect = rect.scaleAndCenter(withRatio: outerRingRatio) let innerPath = UIBezierPath(ovalIn: innerRect).reversing() path.append(innerPath) From 8af804f0aa969a364193a557d24f58e9d0179741 Mon Sep 17 00:00:00 2001 From: Valeriy Van Date: Mon, 19 Jun 2023 15:26:49 +0300 Subject: [PATCH 12/12] Fix typos --- Sources/WeScan/ImageScannerController.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Sources/WeScan/ImageScannerController.swift b/Sources/WeScan/ImageScannerController.swift index b6d915d0..e5002823 100644 --- a/Sources/WeScan/ImageScannerController.swift +++ b/Sources/WeScan/ImageScannerController.swift @@ -27,11 +27,11 @@ public protocol ImageScannerControllerDelegate: NSObjectProtocol { /// - Discussion: Your delegate's implementation of this method should dismiss the image scanner controller. func imageScannerControllerDidCancel(_ scanner: ImageScannerController) - /// Tells the delegate that an error occured during the user's scanning experience. + /// Tells the delegate that an error occurred during the user's scanning experience. /// /// - Parameters: /// - scanner: The scanner controller object managing the scanning interface. - /// - error: The error that occured. + /// - error: The error that occurred. func imageScannerController(_ scanner: ImageScannerController, didFailWithError error: Error) }