nef v0.4.0 is now available
- by Miguel Ángel Díaz López
- November 25, 2019
- swift• functional programming• bow• nef
- 4 minutes to read.
With each release of the nef library, we have concentrated our efforts on adding new integrations; growing the ecosystem. This time, we’ve focused on making nef more reliable.
Version 0.4.0 brings improvements to nef playgrounds, adds a new dependency manager, and opens nef features to developers. If you’ve enjoyed what we’ve created so far, you’ll be happy with the latest additions to the library!
Since the release of Xcode 9, Apple lets us use custom frameworks in Playgrounds. Its setup is a bit cumbersome, but
nef eases this task, and we only need to type
nef playground to create an Xcode Playground compatible with third-party libraries.
As you know, nef resolves the dependencies using
CocoaPods, but now you can use Carthage too. Cool! Let’s take an in-depth view of how this works.
Carthage involves changes in the playground and compile modules of nef. As a result, the following commands will also be available on Carthage:
Create a Playground compatible with your Carthage dependencies.
→ nef playground --name ReleasePlayground --cartfile ./your-cartfile
And, you can specify in which platform it will work.
→ nef playground --name ReleasePlayground --platform osx --cartfile ./your-cartfile
Compile a Playground with Carthage dependencies.
→ nef compile ReleasePlayground
At this point, you might be asking what happened to the Swift Package Manager introduced in Swift 3, and extended in Xcode 11 to be used directly from Xcode projects. Ideally, nef should be compatible with
Carthage, and SPM; but we have to wait for a bug in Xcode 11 that doesn’t let a workspace import targets from a Swift package. Hopefully, it will be fixed in a future version 🤞🏻.
nef has simplified how we work with Xcode Playgrounds and increased their functionality a lot. But when you create a nef Playground, you will notice it contains a mix of files:
xcworkspace, list of
playground and their
On the other hand, Apple offers just one:
example.playground, where they pack everything. Following this approach, we have introduced a new nef Playground container, so you won’t need to fight with all the files anymore. Now, you will have only one!
→ nef playground
It simplifies Playground distribution with the full power of nef.
nef as a Library
While the nef toolset has been open to the community as a working tool since it’s inception; it was not fully open for developer use. That all changes with version 0.4. Now, developers can use the power of nef in their own projects!
nef has been modularized, splitting the command-line UI from its core. The library follows a framework architecture where the public API is under an umbrella framework called
nef, and it distributes as a Swift Package. Therefore, if you want to integrate it into your macOS project, you only need to add the package repository
https://github.com/bow-swift/nef.git in your Xcode 11 project preferences, and add
import nef where you want to use it.
You can find more information about how to integrate it into your projects, a complete API specification, and a practical example in the nef documentation tutorials.
An illustration of what you can do with nef as a library is the recently presented nef plugin, an Xcode Editor Extension.
Finally, I would like to recap what’s new in nef 0.4:
- A new nef Playground container (super cool!). It keeps Xcode Playgrounds and
- Integration of
Carthageinto the supported dependency managers for Cocoa. Expectedly, Apple will fix the Playground bug soon, and we can also incorporate SPM to nef.
nefto developers, enabling a lot of possibilities for using the library. Let’s see what the community can do with that!
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.