Skip to content

Commit

Permalink
Fix some DocC warnings. (#188)
Browse files Browse the repository at this point in the history
* Fix some DocC warnings.

* Update Deprecations.swift

---------

Co-authored-by: Stephen Celis <[email protected]>
  • Loading branch information
mbrandonw and stephencelis authored Jul 31, 2024
1 parent 9df83d0 commit 9f36d95
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 37 deletions.
4 changes: 4 additions & 0 deletions Sources/CasePaths/CasePathable.swift
Original file line number Diff line number Diff line change
Expand Up @@ -476,6 +476,10 @@ extension CasePathable {
/// - Parameters:
/// - keyPath: A case key path to an associated value.
/// - yield: A closure given mutable access to that associated value.
/// - fileID: The fileID where the modify occurs.
/// - filePath: The filePath where the modify occurs.
/// - line: The line where the modify occurs.
/// - column: The column where the modify occurs.
public mutating func modify<Value>(
_ keyPath: CaseKeyPath<Self, Value>,
yield: (inout Value) -> Void,
Expand Down
18 changes: 6 additions & 12 deletions Sources/CasePaths/Documentation.docc/AnyCasePathDeprecations.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ Avoid using deprecated APIs in your app. See the replacement that you should use

### Creating paths

- ``AnyCasePath/init(unsafe:)-4xq8n``
- ``AnyCasePath/init(unsafe:)-2skr2``
- ``AnyCasePath/init(unsafe:)-5fryq``
- ``AnyCasePath/init(unsafe:)-93j7i``
- ``AnyCasePath/init(_:)-5t7e8``
- ``AnyCasePath/init(_:)-5hb2e``
- ``AnyCasePath/init(_:)-65qkv``
- ``AnyCasePath/init(_:)-2cuas``
- ``AnyCasePath/case(_:)-4lmya``
- ``AnyCasePath/case(_:)-6gkwv``
- ``AnyCasePath/case(_:)-1k3jw``
- ``AnyCasePath/case(_:)-g885``
- ``AnyCasePath/constant(_:)``
- ``AnyCasePath/self``
- ``AnyCasePath/some``
Expand All @@ -31,13 +31,7 @@ Avoid using deprecated APIs in your app. See the replacement that you should use
### Appending paths

- ``AnyCasePath/appending(path:)``
- ``AnyCasePath/..(_:_:)-8bw4h``
- ``AnyCasePath/..(_:_:)-8n2ce``
- ``CasePaths/..(_:_:)``

### Matching paths

- ``AnyCasePath/~=(_:_:)``
- ``AnyCasePath/modify(_:_:)``

### Type alias

Expand Down
1 change: 0 additions & 1 deletion Sources/CasePaths/Documentation.docc/CaseKeyPath.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,4 @@
### Partial case paths

- ``PartialCaseKeyPath``
- ``Swift/PartialKeyPath/callAsFunction(_:)``
- ``CasePathable/subscript(case:)-8av06``
2 changes: 1 addition & 1 deletion Sources/CasePaths/Documentation.docc/CasePathable.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

- ``subscript(case:)-6cdhl``
- ``subscript(case:)-8yr2s``
- ``modify(_:yield:file:line:)``
- ``modify(_:yield:fileID:filePath:line:column:)``

### Case properties

Expand Down
8 changes: 4 additions & 4 deletions Sources/CasePaths/Documentation.docc/Deprecations.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Avoid using deprecated APIs in your app. See the replacement that you should use

### Functions

- ``extract(case:from:)-89rof``
- ``extract(case:from:)-82wth``
- ``extract(_:)-2jy2a``
- ``extract(_:)-5ivuf``
- ``extract(case:from:)-262ip``
- ``extract(case:from:)-ylkc``
- ``extract(_:)-34fjh``
- ``extract(_:)-3twft``
6 changes: 0 additions & 6 deletions Sources/CasePaths/EnumReflection.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ extension AnyCasePath {
/// > ``CaseKeyPath``.
///
/// - Parameter embed: An embed function.
/// - Returns: A case path.
@available(iOS, deprecated: 9999, message: "Use a 'CasePathable' case key path, instead")
@available(macOS, deprecated: 9999, message: "Use a 'CasePathable' case key path, instead")
@available(tvOS, deprecated: 9999, message: "Use a 'CasePathable' case key path, instead")
Expand All @@ -37,11 +36,6 @@ extension AnyCasePath {
/// > Important: This operation is provided for backwards compatibility. Avoid introducing it to
/// > your code and instead favor using types that conform to ``CasePathable`` and
/// > ``CaseKeyPath``.
///
/// - Note: This operator is only intended to be used with enum cases that have no associated
/// values. Its behavior is otherwise undefined.
/// - Parameter root: A case with no an associated value.
/// - Returns: A void case path.
@available(iOS, deprecated: 9999, message: "Use a 'CasePathable' case key path, instead")
@available(macOS, deprecated: 9999, message: "Use a 'CasePathable' case key path, instead")
@available(tvOS, deprecated: 9999, message: "Use a 'CasePathable' case key path, instead")
Expand Down
4 changes: 2 additions & 2 deletions Sources/CasePaths/Internal/Deprecations.swift
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ public func XCTUnwrap<Enum, Case>(
_ enum: @autoclosure () throws -> Enum,
case extract: (Enum) -> Case?,
_ message: @autoclosure () -> String = "",
file: StaticString = #file,
file: StaticString = #filePath,
line: UInt = #line
) throws -> Case {
let `enum` = try `enum`()
Expand Down Expand Up @@ -241,7 +241,7 @@ public func XCTModify<Enum, Case>(
case casePath: AnyCasePath<Enum, Case>,
_ message: @autoclosure () -> String = "",
_ body: (inout Case) throws -> Void,
file: StaticString = #file,
file: StaticString = #filePath,
line: UInt = #line
) {
_XCTModify(&`enum`, case: casePath, message(), body, file: file, line: line)
Expand Down
11 changes: 0 additions & 11 deletions Sources/CasePaths/XCTestSupport.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,6 @@ import Foundation
@_spi(CurrentTestCase) import XCTestDynamicOverlay

/// Asserts that an enum value matches a particular case and modifies the associated value in place.
///
/// - Parameters:
/// - optional: An optional value.
/// - message: An optional description of a failure.
/// - body: A closure that can modify the wrapped value of the given optional.
@available(*, deprecated, message: "Use 'CasePathable.modify' to mutate an expected case, instead.")
public func XCTModify<Wrapped>(
_ optional: inout Wrapped?,
Expand All @@ -19,12 +14,6 @@ public func XCTModify<Wrapped>(
}

/// Asserts that an enum value matches a particular case and modifies the associated value in place.
///
/// - Parameters:
/// - enum: An enum value.
/// - casePath: A case path that can extract and embed the associated value of a particular case.
/// - message: An optional description of a failure.
/// - body: A closure that can modify the associated value of the given case.
@available(*, deprecated, message: "Use 'CasePathable.modify' to mutate an expected case, instead.")
public func XCTModify<Enum, Case>(
_ enum: inout Enum,
Expand Down

0 comments on commit 9f36d95

Please sign in to comment.