Skip to content
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 .github/workflows/swiftlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
name: SwiftLint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5
- uses: norio-nomura/action-swiftlint@3.2.1
with:
args: --strict
2 changes: 1 addition & 1 deletion .github/workflows/xcodebuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
- name=Apple TV
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5
- name: Build
run: |
xcodebuild \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ extension String: SecureStorable {
public static func read(key: SecureStoreKey, accessibility: SecureStoreAccessibility) throws -> String? {
let query = _keychainQuery(key: key, accessibility: accessibility)
guard let data = try _keychainGet(query: query) else { return nil }
return String(decoding: data, as: UTF8.self)
return String(bytes: data, encoding: .utf8)
}

public static func write(value: String, for key: SecureStoreKey, accessibility: SecureStoreAccessibility) throws {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,8 @@ extension Array: Storable where Element: RawStorable {
return []
}

public static func read(in store: UserDefaults, key: StoreKey) throws -> Array? {
return store.value(forKey: key._value) as? Array
public static func read(in store: UserDefaults, key: StoreKey) throws -> Self? {
return store.value(forKey: key._value) as? Self
}

public static func write(value: Array, in store: UserDefaults, key: StoreKey) throws {
Expand All @@ -133,8 +133,8 @@ extension Dictionary: Storable where Key: RawStorable, Value: RawStorable {
return [:]
}

public static func read(in store: UserDefaults, key: StoreKey) throws -> Dictionary? {
return store.value(forKey: key._value) as? Dictionary
public static func read(in store: UserDefaults, key: StoreKey) throws -> Self? {
return store.value(forKey: key._value) as? Self
}

public static func write(value: Dictionary, in store: UserDefaults, key: StoreKey) throws {
Expand Down
6 changes: 3 additions & 3 deletions Tests/FHPropertyWrappersTests/SecureStoredTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ final class SecureStoredTests: XCTestCase { // swiftlint:disable:this type_body_
string = "string"
XCTAssertEqual(string, "string")
let data = try XCTUnwrap(_getData(key: $string.key))
XCTAssertEqual(String(decoding: data, as: UTF8.self), "string")
XCTAssertEqual(String(bytes: data, encoding: .utf8), "string")

$string.remove()
XCTAssertEqual(string, "")
Expand Down Expand Up @@ -347,7 +347,7 @@ final class SecureStoredTests: XCTestCase { // swiftlint:disable:this type_body_
optional = "test"
XCTAssertEqual(optional, "test")
let data = _getData(key: $optional.key)
let string = data.map { String(decoding: $0, as: UTF8.self) }
let string = data.flatMap { String(bytes: $0, encoding: .utf8) }
XCTAssertEqual(string, "test")

optional = nil
Expand Down Expand Up @@ -379,7 +379,7 @@ final class SecureStoredTests: XCTestCase { // swiftlint:disable:this type_body_
rawRepresentable = .b
XCTAssertEqual(rawRepresentable, .b)
let data = try XCTUnwrap(_getData(key: $rawRepresentable.key))
XCTAssertEqual(String(decoding: data, as: UTF8.self), "b")
XCTAssertEqual(String(bytes: data, encoding: .utf8), "b")

$rawRepresentable.remove()
XCTAssertEqual(rawRepresentable, .a)
Expand Down
Loading