GRMustache v4.0.1 Release Notes

Release Date: 2019-06-17 // almost 2 years ago

Previous changes from v2.0.0

  • ๐Ÿš€ Released October 23, 2016

    ๐Ÿ†• New

    • Swift 3
    • Templates learned to render Int64, UInt64, Float, and CGFloat.
    • The Box() function is no longer necessary when feeding templates:

      // Still supported
      let rendering = try template.render(Box(["name": "Arthur"]))
      
      // New:
      let rendering = try template.render(["name": "Arthur"])
      

    ๐Ÿ’ฅ Breaking Changes

    • The only collections that can feed Mustache templates are arrays, sets, dictionaries, and Foundation collections that adopt NSFastEnumeration such as NSArray, SSet, NSOrderedSet, NSDictionary, etc. Other Swift collections such as ranges can no longer feed templates.

    • The following APIs were modified:

       // Use nil instead
      -func Box() -> MustacheBox
      
      -typealias KeyedSubscriptFunction = (key: String) -> MustacheBox
      +typealias KeyedSubscriptFunction = (_ key: String) -> Any?
      
      -typealias FilterFunction = (box: MustacheBox, partialApplication: Bool) throws -> MustacheBox
      +typealias FilterFunction = (_ box: MustacheBox, _ partialApplication: Bool) throws -> Any?
      
      -typealias WillRenderFunction = (tag: Tag, box: MustacheBox) -> MustacheBox
      +typealias WillRenderFunction = (_ tag: Tag, _ box: MustacheBox) -> Any?
      
       struct Configuration {
      -    func registerInBaseContext(_ key: String, _ box: MustacheBox)
      +    func register(_ value: Any?, forKey key: String)
       }
      
       class Template {
      -    func registerInBaseContext(_ key: String, _ box: MustacheBox)
      +    func register(_ value: Any?, forKey key: String)
       }
      
       class Context {
      -    func contextWithRegisteredKey(_ key: String, box: MustacheBox) -> Context
      -    func mustacheBoxForKey(_ key: String) -> MustacheBox
      -    func mustacheBoxForExpression(_ string: String) throws -> MustacheBox
      +    func extendedContext(withRegisteredValue value: Any?, forKey key: String) -> Context
      +    func mustacheBox(forKey key: String) -> MustacheBox
      +    func mustacheBox(forExpression string: String) throws -> MustacheBox
       }
      
       class MustacheBox {
      -    func mustacheBoxForKey(_ key: String) -> MustacheBox
      +    func mustacheBox(forKey key: String) -> MustacheBox
       }