Protocols

The following protocols are available globally.

  • Protocol for content types

    See more

    Declaration

    Swift

    public protocol HBMustacheContentType
  • Allow object to override standard hummingbird type rendering which uses String(describing).

    See more

    Declaration

    Swift

    public protocol HBMustacheCustomRenderable
  • Protocol for object that has a custom method for accessing their children, instead of using Mirror

    See more

    Declaration

    Swift

    public protocol HBMustacheParent
  • Objects that can have a transforms run on them. Mustache transforms are specific to this implementation of Mustache. They allow you to process objects before they are rendered.

    The syntax for applying transforms is {{transform(variable)}}. Transforms can be applied to both variables, sections and inverted sections.

    A simple example would be ensuring a string is lowercase.

    {{lowercased(myString)}}
    

    If applying a transform to a sequence then the closing element of the sequence should include the transform name eg

    {{#reversed(sequence)}}{{.}}{{\reversed(sequence)}}
    
    See more

    Declaration

    Swift

    public protocol HBMustacheTransformable