-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
To support Swift 6 syntax such as typed throws. The changes are to address the violation of the optional_data_string_conversion rule.
- Loading branch information
1 parent
d01a78f
commit 66ed42e
Showing
3 changed files
with
19 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
realm/SwiftLint@0.55.1 | ||
realm/SwiftLint@0.57.0 | ||
nicklockwood/[email protected] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import Foundation | ||
|
||
extension String { | ||
enum DecodingError: Swift.Error { | ||
case decodingFailed | ||
} | ||
|
||
/// Like `init(data:encoding:)`, but indicates decoding failure by throwing an error instead of returning an optional. | ||
init(data: Data, encoding: String.Encoding) throws { | ||
guard let decoded = String(data: data, encoding: encoding) else { | ||
throw DecodingError.decodingFailed | ||
} | ||
|
||
self = decoded | ||
} | ||
} |