Skip to content

Commit 5910a9d

Browse files
Pushkar N Kulkarniparkera
authored andcommitted
Change the NSCache API to match the Darwin version (#322)
1 parent c717221 commit 5910a9d

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

Foundation/NSCache.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public class NSCache : NSObject {
3838

3939
public weak var delegate: NSCacheDelegate?
4040

41-
public func objectForKey(_ key: AnyObject) -> AnyObject? {
41+
public func object(forKey key: AnyObject) -> AnyObject? {
4242
var object: AnyObject?
4343

4444
let keyRef = unsafeBitCast(key, to: UnsafePointer<Void>.self)
@@ -157,7 +157,7 @@ public class NSCache : NSObject {
157157
_lock.unlock()
158158
}
159159

160-
public func removeObjectForKey(_ key: AnyObject) {
160+
public func removeObject(forKey key: AnyObject) {
161161
let keyRef = unsafeBitCast(key, to: UnsafePointer<Void>.self)
162162

163163
_lock.lock()

Foundation/NSString.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ internal func _createRegexForPattern(_ pattern: String, _ options: NSRegularExpr
149149
}()
150150
}
151151
let key = "\(options):\(pattern)"
152-
if let regex = local.__NSRegularExpressionCache.objectForKey(key._nsObject) {
152+
if let regex = local.__NSRegularExpressionCache.object(forKey: key._nsObject) {
153153
return (regex as! NSRegularExpression)
154154
}
155155
do {

0 commit comments

Comments
 (0)