47 Degrees joins forces with Xebia read more

nef v0.2.0 is now available

nef v0.2.0 is now available

Last month, we announced the launch of nef, an open source tool for easing the creating of Swift documentation using Swift Playgrounds. This tool allows for compile-time verification of documentation, keeping it in sync with your code. Since the library’s release, we’ve been working on some awesome new features, many of them are thanks to your feedback and contributions. Today, we’re happy to announce the release of nef 0.2.0.

Markdown Support

It’s likely that at some point, you’ve had to write a technical post similar to this one, where you were showing a fancy new feature, helping others understand a particular concept, or illustrating something new you learned. If this is true for you or, is something you plan to do in the future, keep on reading!

nef now lets you build Markdown documents directly from Swift Playgrounds. It’s an incredibly powerful new feature that combines the ability to create Playgrounds with third-party support. Let’s take a look at a practical example.

Imagine you have a Swift Playground project; for our purposes, we’ll use Bow’s documentation. With the new version of nef, you can run the following command:

nef markdown --project ./Documentation --output ./post

Command line for building Markdown

If you go to the output folder, you can see the generated Markdown project, keeping the original structure of pages in the Swift Playground project.

Markdown VS Swift Playground folder structure

If we take a look at the details of one of the output Markdown files and compare it with its counterpart in Swift Playground format, we can see that both files maintain the same structure. Besides, files can be compiled and verified before being published.

Comparison between Markdown and Swift Playground

Hooray 🎉! This way, your Markdown project will be in sync with your code. Moreover, you can integrate it into your CI flow using the command line compilation provided by nef.

Easy use of XCTest

If you’re a lover of Swift Playgrounds like I am, surely you have prototyped using Apple’s framework for testing: XCTest - if not, try it out, it’s so much fun! If you don’t consider this an interesting feature, perhaps we can change your mind. Remember, you can import any framework using nef.

This works almost the same as writing directly in your test target. You only need to import XCTest on your Playground page and write your XCTestCase.

import XCTest

class ExampleTests: XCTestCase {

    func testHelloWorld_Success() {
        let helloWorld = "Hello World!"
        XCTAssertEqual(helloWorld, "Hello World!")

    func testHelloWorld_Failure() {
        let helloWorld = "Hello World!"
        XCTAssertEqual(helloWorld, "Hello World! - Failure")

Normally, this is where you’d need to write a little boilerplate to accomplish this task, but nef does it for you, just write:

Nef.run(testCase: ExampleTests.self)

nef will format the console output to help find out if the suite of tests went well, or if they did not, highlight which tests are failing.

Other changes

This release includes support for Swift 5 and some additional changes like a system for caching nef dependencies. By default, compilation will always clean the project before building it; if you decide you want to use cached dependencies, you only need to add the following flag: --use-cache.

nef compile . --use-cache

With the release of version 0.2.0, nef is now a better, increasingly more stable, and powerful toolset. nef is an active open source project that will continue to grow with lots of possibilities for useful features.

Head over to GitHub and stay tuned for future releases!

For more information or to get involved, check out the following resources for Bow and nef. Comments, questions, issues, and PRs are welcome!

nef is proudly sponsored by 47 Degrees, a Functional Programming consultancy with a focus on the Scala, Kotlin, and Swift Programming languages which supports their active development.

Ensure the success of your project

47 Degrees can work with you to help manage the risks of technology evolution, develop a team of top-tier engaged developers, improve productivity, lower maintenance cost, increase hardware utilization, and improve product quality; all while using the best technologies.