47 Degrees joins forces with Xebia read more

nef 0.5.0 is now available

nef 0.5.0 is now available

Not long ago, we released nef 0.4.0 with a lot of stability improvements, and it also opened up our API to facilitate the creation of more integrations that power up Swift Playgrounds. If you can’t tell, we really love Swift Playgrounds! They are a great tool for trying out new concepts, sketching solutions without the hassle of creating an entire project, or just having fun coding in Swift. In fact, they have major potential for educational purposes, and they constitute a very low entry barrier for newcomers who want to learn Swift.

To make them even more accessible, Apple released the Swift Playgrounds app for iPad. This makes Swift even more approachable, because you don’t need to install Xcode and other tools to develop or try new ideas on your iPad. Recently, Apple even made it possible to run SwiftUI code in the iPad using Playgrounds. However, there was still a limitation: you couldn’t use 3rd party libraries in your Playgrounds on iPad . . . until today.

Bring your dependencies…

An important advancement the Swift community received this year was the Swift Package Manager. Although it’s been with us for a bit longer, its integration with Xcode made a milestone towards its adoption. If you are working from Xcode, you probably don’t need to worry too much about how to specify your dependencies: there is a nice user interface to select your dependencies and include them in each framework where you want to use them.

Nevertheless, your project dependencies can also be described in a manifest file Package.swift, where you can specify your products (the deliverables you can generate from your project), your targets (the individual modules that conform your project), and your dependencies (any 3rd party library or tool you need to use to build your project).

In fact, this is all we need! Let’s say we want to try the last version of Bow on our iPad; we can describe this dependency in a Package.swift file with the following content:

// swift-tools-version:5.1
import PackageDescription

let package = Package(
    name: "MyiPadPlayground",
    dependencies: [
        .package(url: "https://github.com/bow-swift/bow.git", from: "0.6.0"),

For any additional library we want to use, we just need to add its corresponding .package line in the dependencies array.

… and we’ll give you a Playground for your iPad

Once you have the manifest with your dependencies, you only need to run the following nef command:

→ nef ipad --name MyiPadPlayground --package ./Package.swift --output ~/Desktop/Output

nef will generate a Playground Book that bundles your dependency and has some useful tools for running it. For instance, printing to the standard output does not work on iPad, but we added something to make it possible. You can use the following code to print on your iPad:

PlaygroundLog.print("Hello World!")

This leverages some APIs for Playground Books that will prompt a bubble from the bottom right corner of your iPad, showing the printed statements that you have performed. You can clear this at any time by calling:


The generated Playground Book can be loaded into your iPad easily, for instance, via Airdrop. Once you open it, you will have every dependency you included ready to be used; no need to import them. You will even get code completions for the APIs that you included!


Being able to load third party dependencies in an iPad Playground is a long-demanded feature, and we just covered it adding another awesome integration to nef. It has some limitations, as libraries including Objective-C code cannot be compiled and run on an iPad, but it works nicely with 100% pure Swift libraries.

Together with this update, we have launched a new version of the nef Xcode extension. It contains an action to export a Markdown file from a Swift Playground Page, and it is available in the App Store. Why didn’t we add another action to the extension to generate a Playground for iPad? Well, the way we have implemented this feature collides with the sandboxing mechanisms that Apple imposes on applications available in the App Store. However, we are distributing an installer that you can get from our GitHub project release page that provides the Xcode extension with this additional action to generate a Playground with 3rd party dependencies for iPad.

This release is the fifth we’ve done in just a year. nef has been growing slowly but steadily, and we have been using it extensively in our projects. We are very excited with all the features we have added to nef, but this is just the beginning! Join us next year to bring new integrations to nef and make the most out of Swift Playgrounds!

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 Bow and nef. Comments, questions, issues, and PRs are welcome!

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.

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.