Tuesday, July 17, 2018 [Tweets] [Favorites]

Swift GYB

Mattt Thompson:

GYB is a lightweight templating system that allows you to use Python code for variable substitution and flow control:

  • The sequence %{ <#code#> } evaluates a block of Python code
  • The sequence % <#code#>: … % end manages control flow
  • The sequence ${ <#code#> } substitutes the result of an expression

All other text is passed through unchanged.

A good example of GYB can be found in Codable.swift.gyb.

1 Comment

Just in case anyone was still laboring under the charmingly naive belief that #SwiftLang wasn't a total #TrashHouse.

#ComeBackDylanAllIsForgiven

Stay up-to-date by subscribing to the Comments RSS Feed for this post.

Leave a Comment