diff --git a/Documentation/Compass/README.md b/Documentation/Compass/README.md index f2cc89e93..4956d70a5 100644 --- a/Documentation/Compass/README.md +++ b/Documentation/Compass/README.md @@ -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: diff --git a/Sources/ArcGISToolkit/Components/Compass/Compass.swift b/Sources/ArcGISToolkit/Components/Compass/Compass.swift index 45cd76a96..544b5466b 100644 --- a/Sources/ArcGISToolkit/Components/Compass/Compass.swift +++ b/Sources/ArcGISToolkit/Components/Compass/Compass.swift @@ -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 } } diff --git a/Tests/ArcGISToolkitTests/CompassTests.swift b/Tests/ArcGISToolkitTests/CompassTests.swift index 4b93de6b6..23f831ff8 100644 --- a/Tests/ArcGISToolkitTests/CompassTests.swift +++ b/Tests/ArcGISToolkitTests/CompassTests.swift @@ -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) @@ -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) } @@ -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) } }