Last active
August 9, 2018 08:13
-
-
Save mortenbekditlevsen/f45f3ad746167842ac72bb7f94f9b121 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
enum Root {} | |
enum ChatRoom {} | |
struct Message: Codable { | |
var header: String | |
var body: String | |
} | |
struct Configuration: Codable { | |
// Our actual Configuration entity | |
var welcomeMessage: String | |
} | |
extension Path where Element == Root { | |
init() { | |
self.init([]) | |
} | |
} | |
extension Path where Element == Root { | |
var chatrooms: Path<ChatRoom>.Collection { | |
return append("chatrooms") | |
} | |
var configuration: Path<Configuration> { | |
return append("configuration") | |
} | |
} | |
extension Path where Element == ChatRoom { | |
var name: Path<String> { | |
return append("name") | |
} | |
var messages: Path<Message>.Collection { | |
return append("messages") | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment