Skip to content

Compass.automaticallyHides(_:)-> autoHideDisabled(_:) #291

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

Merged
merged 2 commits into from
Apr 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Documentation/Compass/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ Compass:
`Compass` has the following modifiers:

- `func compassSize(size: CGFloat)` - The size of the `Compass`, specifying both the width and height of the compass.
- `func automaticallyHides(_:)` - Specifies whether the ``Compass`` should automatically hide when the heading is 0.
- `func autoHideDisabled(_:)` - Specifies whether the ``Compass`` should automatically hide when the heading is 0.

## Behavior:

Expand Down
6 changes: 3 additions & 3 deletions Sources/ArcGISToolkit/Components/Compass/Compass.swift
Original file line number Diff line number Diff line change
Expand Up @@ -134,11 +134,11 @@ public extension Compass {
}

/// Specifies whether the ``Compass`` should automatically hide when the heading is 0.
/// - Parameter flag: A Boolean value indicating whether the compass should automatically
/// - Parameter disable: A Boolean value indicating whether the compass should automatically
/// hide/show itself when the heading is `0`.
func automaticallyHides(_ flag: Bool) -> some View {
func autoHideDisabled(_ disable: Bool = true) -> some View {
var copy = self
copy.autoHide = flag
copy.autoHide = !disable
return copy
}
}
6 changes: 3 additions & 3 deletions Tests/ArcGISToolkitTests/CompassTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ final class CompassTests: XCTestCase {
var _viewpoint: Viewpoint? = makeViewpoint(rotation: initialValue)
let viewpoint = Binding(get: { _viewpoint }, set: { _viewpoint = $0 })
let compass = Compass(viewpoint: viewpoint)
.automaticallyHides(false) as! Compass
.autoHideDisabled() as! Compass
XCTAssertFalse(compass.shouldHide)
_viewpoint = makeViewpoint(rotation: finalValue)
XCTAssertFalse(compass.shouldHide)
Expand Down Expand Up @@ -54,7 +54,7 @@ final class CompassTests: XCTestCase {
/// `false`.
func testAutomaticallyHidesNoAutoHide() {
let compass = Compass(viewpoint: .constant(nil))
.automaticallyHides(false) as! Compass
.autoHideDisabled() as! Compass
XCTAssertFalse(compass.shouldHide)
}

Expand All @@ -67,7 +67,7 @@ final class CompassTests: XCTestCase {
/// Verifies that the compass correctly initializes when given only a viewpoint.
func testInitWithViewpointAndAutoHide() {
let compass = Compass(viewpoint: .constant(makeViewpoint(rotation: .zero)))
.automaticallyHides(false) as! Compass
.autoHideDisabled() as! Compass
XCTAssertFalse(compass.shouldHide)
}
}
Expand Down