Skip to content

Commit 5bcd740

Browse files
committed
NSFileHandle: move {readability,writability}Handler
Since these are meant to be read/write properties as per Objective-C, this needs to be a stored property. However, it is not possible to have stored properties in an extension. Move the definition into the actual class definition. Default initialize to a closure that will invoke `NSUnimplemented`.
1 parent 09cfc21 commit 5bcd740

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

Foundation/FileHandle.swift

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,14 @@ open class FileHandle : NSObject, NSSecureCoding {
1919
internal var _fd: Int32
2020
internal var _closeOnDealloc: Bool
2121
internal var _closed: Bool = false
22-
22+
23+
open var readabilityHandler: ((FileHandle) -> Void)? = {
24+
(FileHandle) -> Void in NSUnimplemented()
25+
}
26+
open var writeabilityHandler: ((FileHandle) -> Void)? = {
27+
(FileHandle) -> Void in NSUnimplemented()
28+
}
29+
2330
open var availableData: Data {
2431
return _readDataOfLength(Int.max, untilEOF: false)
2532
}
@@ -346,14 +353,6 @@ extension FileHandle {
346353
open func waitForDataInBackgroundAndNotify() {
347354
NSUnimplemented()
348355
}
349-
350-
open var readabilityHandler: ((FileHandle) -> Void)? {
351-
NSUnimplemented()
352-
}
353-
354-
open var writeabilityHandler: ((FileHandle) -> Void)? {
355-
NSUnimplemented()
356-
}
357356
}
358357

359358
extension FileHandle {

0 commit comments

Comments
 (0)