Skip to content

Commit e210391

Browse files
committed
Merge pull request #307 from harlanhaskins/se-0046-lingering
Fixed lingering SE-0046 changes
2 parents 4d5b63f + e5c84cb commit e210391

File tree

6 files changed

+64
-64
lines changed

6 files changed

+64
-64
lines changed

Foundation/NSFileManager.swift

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -801,38 +801,38 @@ public protocol NSFileManagerDelegate : class {
801801
/* fileManager:shouldProceedAfterError:copyingItemAtPath:toPath: gives the delegate an opportunity to recover from or continue copying after an error. If an error occurs, the error object will contain an NSError indicating the problem. The source path and destination paths are also provided. If this method returns YES, the NSFileManager instance will continue as if the error had not occurred. If this method returns NO, the NSFileManager instance will stop copying, return NO from copyItemAtPath:toPath:error: and the error will be provied there.
802802
*/
803803
func fileManager(_ fileManager: NSFileManager, shouldProceedAfterError error: NSError, copyingItemAtPath srcPath: String, toPath dstPath: String) -> Bool
804-
func fileManager(fileManager: NSFileManager, shouldProceedAfterError error: NSError, copyingItemAtURL srcURL: NSURL, toURL dstURL: NSURL) -> Bool
804+
func fileManager(_ fileManager: NSFileManager, shouldProceedAfterError error: NSError, copyingItemAtURL srcURL: NSURL, toURL dstURL: NSURL) -> Bool
805805

806806
/* fileManager:shouldMoveItemAtPath:toPath: gives the delegate an opportunity to not move the item at the specified path. If the source path and the destination path are not on the same device, a copy is performed to the destination path and the original is removed. If the copy does not succeed, an error is returned and the incomplete copy is removed, leaving the original in place.
807807

808808
*/
809-
func fileManager(fileManager: NSFileManager, shouldMoveItemAtPath srcPath: String, toPath dstPath: String) -> Bool
810-
func fileManager(fileManager: NSFileManager, shouldMoveItemAtURL srcURL: NSURL, toURL dstURL: NSURL) -> Bool
809+
func fileManager(_ fileManager: NSFileManager, shouldMoveItemAtPath srcPath: String, toPath dstPath: String) -> Bool
810+
func fileManager(_ fileManager: NSFileManager, shouldMoveItemAtURL srcURL: NSURL, toURL dstURL: NSURL) -> Bool
811811

812812
/* fileManager:shouldProceedAfterError:movingItemAtPath:toPath: functions much like fileManager:shouldProceedAfterError:copyingItemAtPath:toPath: above. The delegate has the opportunity to remedy the error condition and allow the move to continue.
813813
*/
814-
func fileManager(fileManager: NSFileManager, shouldProceedAfterError error: NSError, movingItemAtPath srcPath: String, toPath dstPath: String) -> Bool
815-
func fileManager(fileManager: NSFileManager, shouldProceedAfterError error: NSError, movingItemAtURL srcURL: NSURL, toURL dstURL: NSURL) -> Bool
814+
func fileManager(_ fileManager: NSFileManager, shouldProceedAfterError error: NSError, movingItemAtPath srcPath: String, toPath dstPath: String) -> Bool
815+
func fileManager(_ fileManager: NSFileManager, shouldProceedAfterError error: NSError, movingItemAtURL srcURL: NSURL, toURL dstURL: NSURL) -> Bool
816816

817817
/* fileManager:shouldLinkItemAtPath:toPath: acts as the other "should" methods, but this applies to the file manager creating hard links to the files in question.
818818
*/
819-
func fileManager(fileManager: NSFileManager, shouldLinkItemAtPath srcPath: String, toPath dstPath: String) -> Bool
820-
func fileManager(fileManager: NSFileManager, shouldLinkItemAtURL srcURL: NSURL, toURL dstURL: NSURL) -> Bool
819+
func fileManager(_ fileManager: NSFileManager, shouldLinkItemAtPath srcPath: String, toPath dstPath: String) -> Bool
820+
func fileManager(_ fileManager: NSFileManager, shouldLinkItemAtURL srcURL: NSURL, toURL dstURL: NSURL) -> Bool
821821

822822
/* fileManager:shouldProceedAfterError:linkingItemAtPath:toPath: allows the delegate an opportunity to remedy the error which occurred in linking srcPath to dstPath. If the delegate returns YES from this method, the linking will continue. If the delegate returns NO from this method, the linking operation will stop and the error will be returned via linkItemAtPath:toPath:error:.
823823
*/
824-
func fileManager(fileManager: NSFileManager, shouldProceedAfterError error: NSError, linkingItemAtPath srcPath: String, toPath dstPath: String) -> Bool
825-
func fileManager(fileManager: NSFileManager, shouldProceedAfterError error: NSError, linkingItemAtURL srcURL: NSURL, toURL dstURL: NSURL) -> Bool
824+
func fileManager(_ fileManager: NSFileManager, shouldProceedAfterError error: NSError, linkingItemAtPath srcPath: String, toPath dstPath: String) -> Bool
825+
func fileManager(_ fileManager: NSFileManager, shouldProceedAfterError error: NSError, linkingItemAtURL srcURL: NSURL, toURL dstURL: NSURL) -> Bool
826826

827827
/* fileManager:shouldRemoveItemAtPath: allows the delegate the opportunity to not remove the item at path. If the delegate returns YES from this method, the NSFileManager instance will attempt to remove the item. If the delegate returns NO from this method, the remove skips the item. If the item is a directory, no children of that item will be visited.
828828
*/
829-
func fileManager(fileManager: NSFileManager, shouldRemoveItemAtPath path: String) -> Bool
830-
func fileManager(fileManager: NSFileManager, shouldRemoveItemAtURL URL: NSURL) -> Bool
829+
func fileManager(_ fileManager: NSFileManager, shouldRemoveItemAtPath path: String) -> Bool
830+
func fileManager(_ fileManager: NSFileManager, shouldRemoveItemAtURL URL: NSURL) -> Bool
831831

832832
/* fileManager:shouldProceedAfterError:removingItemAtPath: allows the delegate an opportunity to remedy the error which occurred in removing the item at the path provided. If the delegate returns YES from this method, the removal operation will continue. If the delegate returns NO from this method, the removal operation will stop and the error will be returned via linkItemAtPath:toPath:error:.
833833
*/
834-
func fileManager(fileManager: NSFileManager, shouldProceedAfterError error: NSError, removingItemAtPath path: String) -> Bool
835-
func fileManager(fileManager: NSFileManager, shouldProceedAfterError error: NSError, removingItemAtURL URL: NSURL) -> Bool
834+
func fileManager(_ fileManager: NSFileManager, shouldProceedAfterError error: NSError, removingItemAtPath path: String) -> Bool
835+
func fileManager(_ fileManager: NSFileManager, shouldProceedAfterError error: NSError, removingItemAtURL URL: NSURL) -> Bool
836836
}
837837

838838
public class NSDirectoryEnumerator : NSEnumerator {

Foundation/NSGeometry.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -978,7 +978,7 @@ private extension NSCoder {
978978
self.encodeDouble(value.native, forKey: key)
979979
}
980980

981-
func _decodeCGFloatForKey(key: String) -> CGFloat {
981+
func _decodeCGFloatForKey(_ key: String) -> CGFloat {
982982
return CGFloat(self.decodeDoubleForKey(key))
983983
}
984984
}

Foundation/NSKeyedUnarchiver.swift

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ public class NSKeyedUnarchiver : NSCoder {
176176
/**
177177
Dereferences, but does not decode, an object reference
178178
*/
179-
private func _dereferenceObjectReference(unwrappedObjectRef: CFKeyedArchiverUID) -> Any? {
179+
private func _dereferenceObjectReference(_ unwrappedObjectRef: CFKeyedArchiverUID) -> Any? {
180180
let uid = Int(objectRefGetValue(unwrappedObjectRef))
181181

182182
guard uid < self._objects.count else {
@@ -204,7 +204,7 @@ public class NSKeyedUnarchiver : NSCoder {
204204
return true
205205
}
206206

207-
private static func _supportsSecureCoding(clsv : AnyClass) -> Bool {
207+
private static func _supportsSecureCoding(_ clsv : AnyClass) -> Bool {
208208
if let secureCodable = clsv as? NSSecureCoding.Type {
209209
return secureCodable.supportsSecureCoding()
210210
}
@@ -213,7 +213,7 @@ public class NSKeyedUnarchiver : NSCoder {
213213
}
214214

215215
// FIXME is there a better way to do this with Swift stdlib?
216-
private static func _classIsKindOfClass(assertedClass : AnyClass, _ allowedClass : AnyClass) -> Bool {
216+
private static func _classIsKindOfClass(_ assertedClass : AnyClass, _ allowedClass : AnyClass) -> Bool {
217217
var superClass : AnyClass? = assertedClass
218218

219219
repeat {
@@ -227,7 +227,7 @@ public class NSKeyedUnarchiver : NSCoder {
227227
return false
228228
}
229229

230-
private func _isClassAllowed(assertedClass: AnyClass?, allowedClasses: [AnyClass]?) -> Bool {
230+
private func _isClassAllowed(_ assertedClass: AnyClass?, allowedClasses: [AnyClass]?) -> Bool {
231231
if assertedClass == nil {
232232
return false
233233
}
@@ -248,12 +248,12 @@ public class NSKeyedUnarchiver : NSCoder {
248248
/**
249249
Validate a dictionary with class type information, mapping to a class if allowed
250250
*/
251-
private func _validateAndMapClassDictionary(classDict: Dictionary<String, Any>?,
251+
private func _validateAndMapClassDictionary(_ classDict: Dictionary<String, Any>?,
252252
allowedClasses: [AnyClass]?,
253253
classToConstruct: inout AnyClass?) -> Bool {
254254
classToConstruct = nil
255255

256-
func _classForClassName(codedName: String) -> AnyClass? {
256+
func _classForClassName(_ codedName: String) -> AnyClass? {
257257
var aClass : AnyClass?
258258

259259
aClass = classForClassName(codedName)
@@ -312,7 +312,7 @@ public class NSKeyedUnarchiver : NSCoder {
312312
/**
313313
Validate a class reference against a class list, and return the class object if allowed
314314
*/
315-
private func _validateAndMapClassReference(classReference: CFKeyedArchiverUID,
315+
private func _validateAndMapClassReference(_ classReference: CFKeyedArchiverUID,
316316
allowedClasses: [AnyClass]?) throws -> AnyClass? {
317317
let classUid = objectRefGetValue(classReference)
318318
var classToConstruct : AnyClass? = _classes[classUid]
@@ -337,26 +337,26 @@ public class NSKeyedUnarchiver : NSCoder {
337337
/**
338338
Returns true if objectOrReference represents a reference to another object in the archive
339339
*/
340-
internal static func _isReference(objectOrReference : Any?) -> Bool {
340+
internal static func _isReference(_ objectOrReference : Any?) -> Bool {
341341
if let cf = objectOrReference as? __NSCFType {
342342
return CFGetTypeID(cf) == _CFKeyedArchiverUIDGetTypeID()
343343
} else {
344344
return false
345345
}
346346
}
347347

348-
private func _cachedObjectForReference(objectRef: CFKeyedArchiverUID) -> AnyObject? {
348+
private func _cachedObjectForReference(_ objectRef: CFKeyedArchiverUID) -> AnyObject? {
349349
return self._objRefMap[objectRefGetValue(objectRef)]
350350
}
351351

352-
private func _cacheObject(object: AnyObject, forReference objectRef: CFKeyedArchiverUID) {
352+
private func _cacheObject(_ object: AnyObject, forReference objectRef: CFKeyedArchiverUID) {
353353
self._objRefMap[objectRefGetValue(objectRef)] = object
354354
}
355355

356356
/**
357357
Returns true if the object is a dictionary representing a object rather than a value type
358358
*/
359-
private func _isContainer(object: Any) -> Bool {
359+
private func _isContainer(_ object: Any) -> Bool {
360360
guard let dict = object as? Dictionary<String, Any> else {
361361
return false
362362
}
@@ -370,7 +370,7 @@ public class NSKeyedUnarchiver : NSCoder {
370370
/**
371371
Replace object with another one
372372
*/
373-
private func replaceObject(object: AnyObject, withObject replacement: AnyObject) {
373+
private func replaceObject(_ object: AnyObject, withObject replacement: AnyObject) {
374374
let oid = NSUniqueObject(object)
375375

376376
if let unwrappedDelegate = self.delegate {
@@ -380,12 +380,12 @@ public class NSKeyedUnarchiver : NSCoder {
380380
self._replacementMap[oid] = replacement
381381
}
382382

383-
private func _decodingError(code: NSCocoaError, withDescription description: String) -> NSError {
383+
private func _decodingError(_ code: NSCocoaError, withDescription description: String) -> NSError {
384384
return NSError(domain: NSCocoaErrorDomain,
385385
code: code.rawValue, userInfo: [ "NSDebugDescription" : description ])
386386
}
387387

388-
private func _replacementObject(decodedObject: AnyObject?) -> AnyObject? {
388+
private func _replacementObject(_ decodedObject: AnyObject?) -> AnyObject? {
389389
var object : AnyObject? = nil // object to encode after substitution
390390

391391
// nil cannot be mapped
@@ -411,7 +411,7 @@ public class NSKeyedUnarchiver : NSCoder {
411411
return decodedObject
412412
}
413413

414-
private func _validateClassSupportsSecureCoding(classToConstruct : AnyClass?) -> Bool {
414+
private func _validateClassSupportsSecureCoding(_ classToConstruct : AnyClass?) -> Bool {
415415
var supportsSecureCoding : Bool = false
416416

417417
if let secureDecodableClass = classToConstruct as? NSSecureCoding.Type {
@@ -429,7 +429,7 @@ public class NSKeyedUnarchiver : NSCoder {
429429
/**
430430
Decode an object for the given reference
431431
*/
432-
private func _decodeObject(objectRef: AnyObject) throws -> AnyObject? {
432+
private func _decodeObject(_ objectRef: AnyObject) throws -> AnyObject? {
433433
var object : AnyObject? = nil
434434

435435
_validateStillDecoding()
@@ -526,7 +526,7 @@ public class NSKeyedUnarchiver : NSCoder {
526526
/**
527527
Helper for NSArray/NSDictionary to dereference and decode an array of objects
528528
*/
529-
internal func _decodeArrayOfObjectsForKey(key: String,
529+
internal func _decodeArrayOfObjectsForKey(_ key: String,
530530
@noescape withBlock block: (Any) -> Void) throws {
531531
let objectRefs : Array<Any>? = _decodeValue(forKey: key)
532532

@@ -545,7 +545,7 @@ public class NSKeyedUnarchiver : NSCoder {
545545
}
546546
}
547547

548-
internal override func _decodeArrayOfObjectsForKey(key: String) -> [AnyObject] {
548+
internal override func _decodeArrayOfObjectsForKey(_ key: String) -> [AnyObject] {
549549
var array : Array<AnyObject> = []
550550

551551
do {
@@ -584,20 +584,20 @@ public class NSKeyedUnarchiver : NSCoder {
584584
self._flags.insert(UnarchiverFlags.FinishedDecoding)
585585
}
586586

587-
public class func setClass(cls: AnyClass?, forClassName codedName: String) {
587+
public class func setClass(_ cls: AnyClass?, forClassName codedName: String) {
588588
_classNameMapLock.synchronized {
589589
_classNameMap[codedName] = cls
590590
}
591591
}
592592

593-
public func setClass(cls: AnyClass?, forClassName codedName: String) {
593+
public func setClass(_ cls: AnyClass?, forClassName codedName: String) {
594594
_classNameMap[codedName] = cls
595595
}
596596

597597
// During decoding, the coder first checks with the coder's
598598
// own table, then if there was no mapping there, the class's.
599599

600-
public class func classForClassName(codedName: String) -> AnyClass? {
600+
public class func classForClassName(_ codedName: String) -> AnyClass? {
601601
var mappedClass : AnyClass?
602602

603603
_classNameMapLock.synchronized {
@@ -607,16 +607,16 @@ public class NSKeyedUnarchiver : NSCoder {
607607
return mappedClass
608608
}
609609

610-
public func classForClassName(codedName: String) -> AnyClass? {
610+
public func classForClassName(_ codedName: String) -> AnyClass? {
611611
return _classNameMap[codedName]
612612
}
613613

614-
public override func containsValueForKey(key: String) -> Bool {
614+
public override func containsValueForKey(_ key: String) -> Bool {
615615
let any : Any? = _decodeValue(forKey: key)
616616
return any != nil
617617
}
618618

619-
public override func decodeObjectForKey(key: String) -> AnyObject? {
619+
public override func decodeObjectForKey(_ key: String) -> AnyObject? {
620620
do {
621621
return try _decodeObject(forKey: key)
622622
} catch let error as NSError {
@@ -628,7 +628,7 @@ public class NSKeyedUnarchiver : NSCoder {
628628
}
629629

630630
// private variant of decodeObjectOfClasses() that supports generic (unkeyed) objects
631-
private func _decodeObjectOfClasses(classes: [AnyClass], forKey key: String? = nil) -> AnyObject? {
631+
private func _decodeObjectOfClasses(_ classes: [AnyClass], forKey key: String? = nil) -> AnyObject? {
632632
do {
633633
self._allowedClasses.append(classes)
634634
defer { self._allowedClasses.removeLast() }

0 commit comments

Comments
 (0)