Skip to content

Class

LeafRenderer

LeafRenderer implements the full Leaf language pipeline.
final class LeafRenderer

Overview

It must be configured before use with the appropriate LeafConfiguration and consituent threadsafe protocol-implementating modules (an NIO EventLoop, LeafCache, LeafSource, and potentially any number of custom LeafTag additions to the language).

Additional instances of LeafRenderer can then be created using these shared modules to allow concurrent rendering, potentially with unique per-instance scoped data via userInfo.

Topics

Initializers

Instance Properties

  • cache
    A thread-safe implementation of LeafCache protocol
  • configuration
    An initialized LeafConfiguration specificying default directory and tagIndicator
  • eventLoop
    The NIO EventLoop on which this instance of LeafRenderer will operate
  • sources
    A thread-safe implementation of LeafSource protocol
  • tags
    A keyed dictionary of custom LeafTags to extend Leaf’s basic functionality, registered with the names which will call them when rendering - eg tags["tagName"] can be used in a template as #tagName(parameters)
  • userInfo
    Any custom instance data to use (eg, in Vapor, the Application and/or Request data)

Instance Methods