Last year, when we started writing Functional Programming in Swift, we realized that the language would change every few weeks. We didn't anticipate the pace, but we were ready for change. Rather than manually updating every article, we used a technique called literate programming. In literate programming, you write the code and text at the same time. The code in the text can be executed. To do this, we wrote a small script called Literate Swift.
For our two new books, Core Data and Advanced Swift, we are using the same technique, except with a newer version of the tool. Literate Swift is a library (and comes with a GUI or command-line tool) that takes a Markdown file, extracts all the code blocks marked with swift
, and compiles those. The awesome thing about it is that you can compile your Markdown: you can statica