Swiftpack.co - hummingbird-project/swift-mustache as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by hummingbird-project.
hummingbird-project/swift-mustache 2.0.0-beta.1
Mustache templating engine
⭐️ 4
🕓 6 weeks ago
iOS macOS watchOS tvOS
.package(url: "https://github.com/hummingbird-project/swift-mustache.git", from: "2.0.0-beta.1")

Swift-Mustache

Package for rendering Mustache templates. Mustache is a "logic-less" templating language commonly used in web and mobile platforms. You can find out more about Mustache here.

Usage

Load your templates from the filesystem

import Mustache
let library = MustacheLibrary("folder/my/templates/are/in")

This will look for all the files with the extension ".mustache" in the specified folder and subfolders and attempt to load them. Each file is registed with the name of the file (with subfolder, if inside a subfolder) minus the "mustache" extension.

Render an object with a template

let output = library.render(object, withTemplate: "myTemplate")

Swift-Mustache treats an object as a set of key/value pairs when rendering and will render both dictionaries and objects via Mirror reflection. Find out more on how Mustache renders objects here.

Support

Swift-Mustache supports all standard Mustache tags and is fully compliant with the Mustache spec with the exception of the Lambda support.

Additional features

Swift-Mustache includes some features that are specific to its implementation. Please follow the links below to find out more.

Documentation

Reference documentation for swift-mustache can be found here

GitHub

link
Stars: 4
Last commit: 5 weeks ago
Advertisement: IndiePitcher.com - Cold Email Software for Startups

Release Notes

v2.0.0 Beta 1
6 weeks ago

Major release changes

  • Renamed package to swift-mustache and library has been renamed to Mustache
  • Removed "HB" prefix from all symbols

Other changes

  • Merged 2.0 branch into main

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics