Skip to content

Commit da4e2a5

Browse files
authored
Merge pull request #291 from Esri/df/disableAutoHide
`Compass.automaticallyHides(_:)`-> `autoHideDisabled(_:)`
2 parents 7c63f93 + 32ca9de commit da4e2a5

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

Documentation/Compass/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ Compass:
5050
`Compass` has the following modifiers:
5151

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

5555
## Behavior:
5656

Sources/ArcGISToolkit/Components/Compass/Compass.swift

+3-3
Original file line numberDiff line numberDiff line change
@@ -134,11 +134,11 @@ public extension Compass {
134134
}
135135

136136
/// Specifies whether the ``Compass`` should automatically hide when the heading is 0.
137-
/// - Parameter flag: A Boolean value indicating whether the compass should automatically
137+
/// - Parameter disable: A Boolean value indicating whether the compass should automatically
138138
/// hide/show itself when the heading is `0`.
139-
func automaticallyHides(_ flag: Bool) -> some View {
139+
func autoHideDisabled(_ disable: Bool = true) -> some View {
140140
var copy = self
141-
copy.autoHide = flag
141+
copy.autoHide = !disable
142142
return copy
143143
}
144144
}

Tests/ArcGISToolkitTests/CompassTests.swift

+3-3
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ final class CompassTests: XCTestCase {
2525
var _viewpoint: Viewpoint? = makeViewpoint(rotation: initialValue)
2626
let viewpoint = Binding(get: { _viewpoint }, set: { _viewpoint = $0 })
2727
let compass = Compass(viewpoint: viewpoint)
28-
.automaticallyHides(false) as! Compass
28+
.autoHideDisabled() as! Compass
2929
XCTAssertFalse(compass.shouldHide)
3030
_viewpoint = makeViewpoint(rotation: finalValue)
3131
XCTAssertFalse(compass.shouldHide)
@@ -54,7 +54,7 @@ final class CompassTests: XCTestCase {
5454
/// `false`.
5555
func testAutomaticallyHidesNoAutoHide() {
5656
let compass = Compass(viewpoint: .constant(nil))
57-
.automaticallyHides(false) as! Compass
57+
.autoHideDisabled() as! Compass
5858
XCTAssertFalse(compass.shouldHide)
5959
}
6060

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

0 commit comments

Comments
 (0)