-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #87 from cocoatype/81-extract-observations-to-module
Extract Observations to module
- Loading branch information
Showing
45 changed files
with
166 additions
and
88 deletions.
There are no files selected for viewing
25 changes: 25 additions & 0 deletions
25
Modules/Capabilities/Observations/Sources/Extensions/GeometryExtensions.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// Created by Geoff Pado on 5/8/24. | ||
// Copyright © 2024 Cocoatype, LLC. All rights reserved. | ||
|
||
import CoreGraphics | ||
|
||
extension CGPoint { | ||
static func flippedPoint(from point: CGPoint, scaledTo size: CGSize) -> CGPoint { | ||
var scaledPoint = point | ||
|
||
#if canImport(UIKit) | ||
scaledPoint.y = (1.0 - scaledPoint.y) | ||
#endif | ||
|
||
scaledPoint.x *= size.width | ||
scaledPoint.y *= size.height | ||
|
||
return scaledPoint | ||
} | ||
} | ||
|
||
extension CGSize { | ||
static func * (size: CGSize, multiplier: CGFloat) -> CGSize { | ||
return CGSize(width: size.width * multiplier, height: size.height * multiplier) | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
...Sources/Extensions/StringExtensions.swift → ...Sources/Extensions/StringExtensions.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 5 additions & 8 deletions
13
...Text Detection/CharacterObservation.swift → ...s/Observations/CharacterObservation.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 2 additions & 5 deletions
7
...rces/Text Detection/WordObservation.swift → ...ources/Observations/WordObservation.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// Created by Geoff Pado on 10/19/23. | ||
// Copyright © 2023 Cocoatype, LLC. All rights reserved. | ||
|
||
import XCTest | ||
|
||
@testable import Observations | ||
|
||
final class ShapeTests: XCTestCase { | ||
func testIsNotEmptyReturnsFalseForEmptyShape() { | ||
let emptyShape = Shape( | ||
bottomLeft: CGPoint(x: 5, y: 5), | ||
bottomRight: CGPoint(x: 5, y: 5), | ||
topLeft: CGPoint(x: 5, y: 5), | ||
topRight: CGPoint(x: 5, y: 5) | ||
) | ||
|
||
XCTAssertFalse(emptyShape.isNotEmpty) | ||
} | ||
|
||
func testIsNotEmptyReturnsTrueForNonEmptyShape() { | ||
let shape = Shape( | ||
bottomLeft: CGPoint(x: 0, y: 5), | ||
bottomRight: CGPoint(x: 5, y: 5), | ||
topLeft: CGPoint(x: 0, y: 0), | ||
topRight: CGPoint(x: 5, y: 0) | ||
) | ||
|
||
XCTAssertTrue(shape.isNotEmpty) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
Modules/Legacy/Editing/Sources/Editing View/PhotoEditingObservationVisualizationView.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
Modules/Legacy/Editing/Sources/Editing View/PhotoEditingScrollView.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
Modules/Legacy/Editing/Sources/Editing View/PhotoEditingView.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ | |
|
||
import AutoRedactionsUI | ||
import Defaults | ||
import Observations | ||
import Photos | ||
import UIKit | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
Modules/Legacy/Editing/Sources/Editing View/Workspace/RedactionPathLayer.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.