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
| @dynamicMemberLookup | |
| struct Template { | |
| var template : String | |
| private var data : [String:String] | |
| var populatedTemplate : String { data.reduce(template) { $0.replacingOccurrences(of: "${\($1.key)}", with: $1.value) } } | |
| init(template: String, data: [String:String] = [:]) { | |
| self.template = template | |
| self.data = data | |
| } |
OlderNewer