-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add FileName for the name property of files
Resolves #2
- Loading branch information
1 parent
c4e6d2a
commit 3ee050a
Showing
4 changed files
with
41 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import Foundation | ||
|
||
public struct FileName: Equatable, Hashable { | ||
fileprivate let value: String | ||
public init(_ value: String) { | ||
self.value = value | ||
} | ||
} | ||
|
||
extension FileName: ExpressibleByStringLiteral { | ||
public init(stringLiteral value: String) { | ||
self.init(value) | ||
} | ||
} | ||
|
||
extension FileName: ExpressibleByStringInterpolation {} | ||
|
||
extension FileName: CustomStringConvertible { | ||
public var description: String { value } | ||
} | ||
|
||
extension FileName: CustomDebugStringConvertible { | ||
public var debugDescription: String { value } | ||
} | ||
|
||
extension URL { | ||
func appending(_ name: FileName) -> URL { | ||
appendingPathComponent(name.value) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters