Comments (1)
Hello, @CharlesJS
Thank you for your feedback.
At this time, we do not have plans to create a custom encoder that conforms to Codable. However, if you wish to address this easily, you might consider adding a code snippet like the one below.
import Mustache
extension Encodable {
var mustacheObject: MustacheBox? {
guard
let data = try? JSONEncoder().encode(self),
let dictionary = try? JSONSerialization.jsonObject(with: data) as [String: Any] else {
return nil
}
return Box(dictionary)
}
}
you can use this like below.
struct SomeCodable: Codable {
let foo: String
let bar: Int
}
let object: SomeCodable = .init(foo: "foo", bar: 1)
let template = try Template(string: "your_template")
try template.render(object.mustacheObject)
from grmustache.swift.
Related Issues (20)
- Crashes in Xcode 10 HOT 2
- Abandoned? HOT 1
- 3.1.0 and 4.0.0 releases not available via Cocoapods HOT 1
- 3.x and 4.x huge performance issue HOT 5
- Linux support HOT 2
- Is it possible to detect plain text URLs and phone links and make it an actionable link?
- Is it possible to throw an error when a tag inside a template is missing?
- Incorrect use of URL causes failure on files containing spaces.
- Mustache tags on new lines are replaced with empty space HOT 2
- Deprecated 'class' keyword HOT 1
- Static library support
- Post-rendering Lambda? HOT 3
- Fail to execute testing on Xcode 14.0 HOT 1
- Latest version is not compatible with XCodee 14.3. HOT 2
- Is it Possible to passe text from template to a function?
- Just not working HOT 9
- Problems with PFObject HOT 3
- 'pod lib lint' validation fails in XCode 14.3 and above
- New release please! HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from grmustache.swift.