47 Degrees joins forces with Xebia read more

nef v0.4.0 is now available

nef v0.4.0 is now available

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!

Dependency Management

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

Integration with 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 CocoaPods, 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 Playgrounds

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: xcodeproj, xcworkspace, list of playground and their dependencies.

Old structure of nef Playground

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

new nef Playground container

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.

Conclusions

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 nef well integrated.
  • Integration of Carthage into the supported dependency managers for Cocoa. Expectedly, Apple will fix the Playground bug soon, and we can also incorporate SPM to nef.
  • Opens nef to 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 Bow and nef. Comments, questions, issues, and PRs are welcome!

Xebia Functional, formerly 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.