Skip to content

Commit e12f9d5

Browse files
committed
Conform FKFileType to CSC and CDSC
- CSC: CustomStringConvertible - CDSC: CustomDebugStringConvertible The description and debugDescription make use of self.dynamicType, so every type that conforms to FKFileType will have its own custom string returned.
1 parent 7155740 commit e12f9d5

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

FileKit/Core/FKFileType.swift

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
import Foundation
2929

3030
/// A type that repressents a filesystem file.
31-
public protocol FKFileType {
31+
public protocol FKFileType: CustomStringConvertible, CustomDebugStringConvertible {
3232

3333
/// The type for which the file reads and writes data.
3434
typealias DataType
@@ -91,4 +91,19 @@ public extension FKFileType {
9191
}
9292
}
9393

94+
95+
// Mark: - CustomStringConvertible
96+
97+
public var description: String {
98+
return String(self.dynamicType) + ": (" + path.description + ")"
99+
}
100+
101+
// MARK: - CustomDebugStringConvertible
102+
103+
public var debugDescription: String {
104+
return String(self.dynamicType) + ": (" + path.debugDescription + ")"
105+
}
106+
94107
}
108+
109+

0 commit comments

Comments
 (0)