nef 0.6 is now available
- by Miguel Ángel Díaz López
- May 07, 2020
- swift• functional programming• bow• nef
- 4 minutes to read.
One year ago, we launched the first version of nef, and we haven’t stopped enhanching this awesome tool. It was born as a Command-Line tool, and today, it can also be utilized as an Xcode plugin and as a Library. Now, one year after the launch, we are releasing nef 0.6 with a bunch of features focused on stability and usability.
What’s new in version 0.6?
- 🏹 Rewrite nef using Functional Programming.
- 🌐 Redesign the microsite.
- 🍺 Official integration with Homebrew.
nef ♡ FP
As you know, nef is part of a functional ecosystem around Bow. Functional Programming encourages us to write modular and testable code, improving maintainability. In the end, it leads us to write robust and trustworthy code. Following this goal, and taking advantage of Bow, we have rewritten nef using a functional approach from the core to the UI.
We started working on this modularization for nef 0.4, launching the first version of the library. Today, four months later, we have completed it, opening all nef features to developers. It is amazing because, with a simple
import nef, you can use any nef feature directly in your macOS app or your command line. It enables building new tooling like an Xcode plugin to publish articles from your Playgrounds, or a tool for making PDF books from your Playgrounds. You set the limit!
nef 0.6 provides multiple APIs, so we have created an API Reference section on the site to search for specific APIs, types, or methods. We use a customized version of Jazzy together with
nef jekyll to generate these docs.
Briefly, the new APIs that come with this release are:
Xcode Playgrounds are a friendly tool for prototyping and trying new concepts. However, they have some limitations if you need to create playgrounds with 3rd-party libraries support or make your Xcode Playground compatible with the rest of the options. This API bridges the gap between Playgrounds and 3rd-party library support.
Compile a nef Playground from the command line in the same way you do from Xcode.
Clean a nef Playground; for example, to share it as light as possible (without any additional compilation files).
Render the content of a Playground page, or anything else that contains markup formatting and code.
Render content that contains Markdown, code, and nef commands to create a verified static website or blog.
Share some Swift snippets as images using this API that integrates nef with Carbon.
Playground Book API
Create a Playground Book with 3rd-party libraries from a Swift Package specification.
Official integration with Homebrew
Homebrew is an unofficial package manager for macOS; it has become a de facto standard to install any package/tool in your system. From version 0.6, nef has been included in the main repository. Thus, to install nef, you only need to run:
brew install nef
You can even integrate with GitHub Actions easily; an example to compile your nef Playground would be:
build: runs-on: macos-latest steps: - uses: actions/checkout@v2 - name: Compile Playground run: | brew install nef nef compile --project <nef Playground>
This is a huge release; from the outside, you will continue seeing nef as you always have. But inside-the-box, now it is written in pure Swift following a functional paradigm thanks to Bow. It brings us benefits such as:
- A modularized codebase that is easy to maintain, test, and debug.
- Opens all the current and future nef features to developers as a library.
- Lets us integrate Swift libraries, like Apple’s recently released swift-argument-parser for type-safe argument parsing. You can find an elaborate usage example in the UI modules.
Head over to our GitHub repo, and stay tuned for news on future releases!
For more information, or to get involved, check out the following resources for
nef. Comments, questions, issues, and PRs are welcome!
- nef on GitHub
- nef (Xcode extension) on GitHub
- Bow’s Gitter Channel
- @Bow_Swift on Twitter
47 Degrees, a Functional Programming consultancy with a focus on the Scala, Kotlin, Haskell and Swift Programming languages proudly sponsors the active development of nef.