Skip to content

Latest commit

 

History

History
56 lines (28 loc) · 2.27 KB

faq.md

File metadata and controls

56 lines (28 loc) · 2.27 KB

GRMustache FAQ

  • Is GRMustache thread-safe?

    Thread-safety of non-mutating methods is guaranteed. Thread-safety of mutating methods is not guaranteed.

  • Is it possible to iterate over key/value pairs of a dictionary?

    Yes.

  • Is it possible to render array indexes? Customize first and last elements? Distinguish odd and even items?

    Yes, yes, and yes.

  • Is it possible to format numbers and dates?

    Yes. Use NSNumberFormatter and NSDateFormatter.

  • Is it possible to pluralize/singularize strings?

    Yes. You have some sample code in issue #50. You may check @mattt's InflectorKit for actual inflection methods.

  • Is it possible to write Handlebars-like helpers?

    Yes

  • Is it possible to localize templates?

    Yes

  • Is it possible to embed partial templates whose name is only known at runtime?

    Yes

  • Does GRMustache provide any layout or template inheritance facility?

    Yes

  • Is it possible to render a default value for missing keys?

    Yes

  • Is it possible to disable HTML escaping?

    Yes

  • What are those NSUndefinedKeyException?

    When GRMustache has to try several objects until it finds the one that provides a {{key}}, several NSUndefinedKeyException may be raised and caught. Those exceptions are part of the normal template rendering. You can be prevent them, though: see the Runtime Guide.

  • Why does GRMustache need JRSwizzle?

    GRMustache does not need it, and does not swizzle anything unless you explicitly ask for it. [GRMustache preventNSUndefinedKeyExceptionAttack] swizzles NSObject's valueForUndefinedKey: in order to prevent NSUndefinedKeyException during template rendering. See the Runtime Guide for a detailed discussion.