Skip to content

Commit fb2b5ee

Browse files
committed
Cleanup: DiffableTextKit/Cache, misc.
1 parent 0f0e58e commit fb2b5ee

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

Sources/DiffableTextKit/Support/Cache.swift

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public final class Cache<Key, Value> where Key: Hashable, Value: AnyObject {
1919
// MARK: State
2020
//=------------------------------------------------------------------------=
2121

22-
@usableFromInline let nscache: NSCache<Wrapper, Value>
22+
@usableFromInline let nscache: NSCache<NSKey, Value>
2323

2424
//=------------------------------------------------------------------------=
2525
// MARK: Initializers
@@ -38,19 +38,19 @@ public final class Cache<Key, Value> where Key: Hashable, Value: AnyObject {
3838
//=------------------------------------------------------------------------=
3939

4040
@inlinable public func access(_ key: Key) -> Value? {
41-
nscache.object(forKey: Wrapper(key))
41+
nscache.object(forKey: NSKey(key))
4242
}
4343

4444
@inlinable public func insert(_ value: Value, as key: Key) {
45-
nscache.setObject(value, forKey: Wrapper(key))
45+
nscache.setObject(value, forKey: NSKey(key))
4646
}
4747

4848
@inlinable public func remove(_ key: Key) {
49-
nscache.removeObject(forKey: Wrapper(key))
49+
nscache.removeObject(forKey: NSKey(key))
5050
}
5151

5252
@inlinable public func reuse(_ key: Key, make: @autoclosure () throws -> Value) rethrows -> Value {
53-
let key = Wrapper(key)
53+
let key = NSKey(key)
5454
//=--------------------------------------=
5555
// MARK: Search
5656
//=--------------------------------------=
@@ -67,10 +67,10 @@ public final class Cache<Key, Value> where Key: Hashable, Value: AnyObject {
6767
}
6868

6969
//*========================================================================*
70-
// MARK: * Key
70+
// MARK: * NSKey
7171
//*========================================================================*
7272

73-
@usableFromInline final class Wrapper: NSObject {
73+
@usableFromInline final class NSKey: NSObject {
7474

7575
//=--------------------------------------------------------------------=
7676
// MARK: State

Tests/DiffableTextViewsXiOSTests/Views/ViewsTests+UITextField.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,12 @@ final class ViewsTestsXUITextField: XCTestCase {
3434
XCTAssertNotNil(uiTextField.text)
3535
}
3636

37-
func testForceUnwrappingSelectionIsOK() {
37+
func testForceUnwrappingSelectedTextRangeIsOK() {
3838
uiTextField.selectedTextRange = nil
3939
XCTAssertNotNil(uiTextField.selectedTextRange)
4040
}
4141

42-
func testForceUnwrappingMarkedTextRangeIsDisallowed() {
42+
func testForceUnwrappingMarkedTextRangeIsBad() {
4343
XCTAssertNil(uiTextField.markedTextRange)
4444
}
4545
}

0 commit comments

Comments
 (0)