47 Degrees joins forces with Xebia read more

nef v0.3.0 is now available

nef v0.3.0 is now available

Since the initial launch of nef in April, a lot of cool features have been incorporated into the library. Some of these changes include the ability to build microsites using a Jekyll integration and Xcode Playgrounds and the ability to generate Markdown files. In three months, nef has grown from being a library “just” for the compilation and creation of projects, to being the best partner for Xcode Playgrounds and helping to create and share valuable technical knowledge with the community. Continuing on this path, we are super happy to announce the release of nef 0.3.0. This release brings a new integration with carbon but this isn’t the only news, keep on reading!


We are focusing our efforts on improving nef’s usability. As a result, we have created a microsite for nef where you can find the full documentation on what you can do with nef, how to use it, and examples for taking your first steps with the tool. The documentation is structured to cover the main topics: Verification and Compilation, Generation of Markdown documents, and Integrations.

To write these docs, we’re using Xcode Playgrounds and compiling them using nef. If you go to nef/contents/documentation, you can find the xcworkspace which links all the Xcode Playgrounds. If you want to contribute to a section, you only need to select the Playground and add new content on its page. Each Playground is rendered in a new Section and their pages as entries. Then, our Continuous Integration using nef will compile the docs and generate the pages that are deployed automatically by Github Pages.

Carbon integration

We’ve started a new initiative on Twitter called #BowShots, where we provide small examples of the Bow library in standard Swift code. At this point, we need to create verified Swift examples, document the proposal of each piece of code, and generate a code snippet for sharing in social networks. This is where nef comes to the rescue!

It’s a common situation to encounter - you need to share pieces of code with your colleagues, prepare a technical talk, explain some concepts, write a post, publish a tweet and you would like to create a cool screenshot. Enter carbon, an open source tool that makes this possible.

Now, you may wonder, can you combine carbon with the power of Xcode Playgrounds to export cool code snippets? The quick answer is yes, by using nef version 0.3.0.

Carbon integration with nef is a match made in heaven! Just imagine the possibilities while we write a little code. Open an Xcode Playground created by nef and on the main page, write:

let announcement = "nef 0.3.0 released!"
print("I'm so excited for \(announcement)!")

// I'm so excited for nef 0.3.0 released!

Running the following command will export your Xcode Playgrounds to cool screenshots.

nef carbon --project . --output ~/Desktop/nef

Command line for building Carbon code snippets

I encourage you to add more examples in the Playground, split them using markdown comments, and rerun nef. Awesome!

Wait! Wait! This is all super exciting, but can you customize it? Of course, you can! Carbon integration has been parametrized, and you can run nef with several options, including background color, size, and font type. You can read more about customizing the output in the carbon’s nef documentation. This is also where you can find a complete practical use case.

Other changes

Check nef’s version

This is nef’s third major release. If you want to check which version of nef you have installed, you can use the following command:

nef --version

Improvements in nef’s compiler

A bug in the nef compiler used a statically linked binaries flag over Darwin architectures like macOS. To solve this, we have refactored how nef’s compiler works using linked static libraries and frameworks instead. It may sound similar but it’s not. The main reason why Apple does not support statically linked binaries is that it does not import system dependencies dynamically -as static libraries do-; instead, it makes direct system calls into the kernel, which is a significant compatibility risk.

So how does nef’s compiler work? Generally, given a playground page, nef builds all the user dependencies and saves them as frameworks in a local directory; during the compilation, nef statically links these frameworks together with Apple’s dependencies into Swift files - including the sources. In the next diagram, you can see this in a simplified form:

How does `nef`'s' compiler work?

Besides fixing the compiler bug, we have migrated the iOS system architecture x86_64 to arm64 using the SDK iphoneos; this is partially because dependencies like XCTest only are compatible with arm.

Increasingly stable

Version 0.3.0 fixes several bugs and increases the stability of nef. You can view the details on nef’s release listings on GitHub. nef is an active open source project that will continue to grow and has the possibility to gain many useful features; feel free to create an issue if you encounter a bug or malfunction.

Head over to nef’s GitHub repo and stay tuned for news on 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 Xebia Functional, formerly 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.