Skip to content

Commit

Permalink
Begin tweaking comments with LLM PT.2
Browse files Browse the repository at this point in the history
  • Loading branch information
eonist committed Sep 22, 2023
1 parent ffe9c6d commit 0e29cb4
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 15 deletions.
15 changes: 10 additions & 5 deletions Sources/Spatial/align/AlignType/AlignType.swift
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
import Foundation
/**
* Single align type
* - Remark: Use `.rawValue` if you want to get the string "topLeft"
* - Remark: Could also just do: no type enum and: `Swift.print("\(String(describing: TestEnum.three))") // three
* Enum defining single alignment types.
* Use `.rawValue` to get the string representation of the enum case.
* Alternatively, you can use a no-type enum and print the case name directly.
*/
public enum AlignType: String {
case left, right, top, bottom, centerHor, centerVer
}
case left // Aligns to the left
case right // Aligns to the right
case top // Aligns to the top
case bottom // Aligns to the bottom
case centerHor // Aligns to the horizontal center
case centerVer // Aligns to the vertical center
}
18 changes: 12 additions & 6 deletions Sources/Spatial/align/alignment/Alignment+Extension.swift
Original file line number Diff line number Diff line change
@@ -1,25 +1,31 @@
import Foundation
/**
* Extension
* Extension to `Alignment` enum to provide computed properties for horizontal and vertical alignment types.
*/
extension Alignment {
/**
* - Returns the horizontal type from the dual-axis type `Alignment`
* Returns the horizontal alignment type from the dual-axis alignment type `Alignment`.
*/
public var horAlign: HorizontalAlign {
switch self {
// If the alignment is top left, center left, or bottom left, return left alignment
case .topLeft, .centerLeft, .bottomLeft: return .left
// If the alignment is top right, center right, or bottom right, return right alignment
case .topRight, .bottomRight, .centerRight: return .right
case .bottomCenter, .topCenter, .centerCenter: return .centerX
// If the alignment is top center, bottom center, or center center, return center X alignment
case .topCenter, .bottomCenter, .centerCenter: return .centerX
}
}
/**
* - Returns the vertical type from the dual-axis type `Alignment`
* Returns the vertical alignment type from the dual-axis alignment type `Alignment`.
*/
public var verAlign: VerticalAlign {
switch self {
case .topRight, .topCenter, .topLeft: return .top
case .bottomCenter, .bottomRight, .bottomLeft: return .bottom
// If the alignment is top left, top center, or top right, return top alignment
case .topLeft, .topCenter, .topRight: return .top
// If the alignment is bottom left, bottom center, or bottom right, return bottom alignment
case .bottomLeft, .bottomCenter, .bottomRight: return .bottom
// If the alignment is center left, center right, or center center, return center Y alignment
case .centerRight, .centerLeft, .centerCenter: return .centerY
}
}
Expand Down
5 changes: 2 additions & 3 deletions Sources/Spatial/align/alignment/Alignment.swift
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import Foundation

/**
* Alignment types (Both axises)
* - Remark: Use `Alignment.topLeft.rawValue if you want to get the string "topLeft"
* Enum defining alignment types for both horizontal and vertical axises.
* Use `Alignment.topLeft.rawValue` to get the string "topLeft".
*/
public enum Alignment: String {
case topLeft // Aligns to the top left corner
Expand Down
3 changes: 2 additions & 1 deletion Tests/SpatialTests/SpatialTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,5 @@ extension SpatialTests {
XCTAssertTrue(equalsB)
}
}
#endif
#endif

0 comments on commit 0e29cb4

Please sign in to comment.