How to export my snippets?
In this tutorial, we assume you do not have any project, and we will follow up from the beginning. If you have a current project, you can jump straight to third step.
Step 1: Create a new
You will need a
nef Playground. Therefore, you can start to create a new one with this command:
➜ nef playground --name TutorialCarbon
Go back to Creating a nef Playground to read more about these and other parameters you can use.
Step 2: Add content to nef Playground
TutorialCarbon.app playground. It is an easy view where to see the future Playgrounds you will be creating and their pages.
Now we will add some content to our Xcode Playground. Open the associated
page and write:
let example = "This is my first snippet" print("\(example) created by nef!") // This is my first snippet created by nef!
Step 3: Generate code snippets
Using your terminal we will export all code snippets using
nef and your
nef Playground, in our case from
➜ nef carbon --project TutorialCarbon.app --output ~/Desktop/snippets
But let’s not stop here, we can customize the output! Running the following command we will customize the
background color to bow,
hide the number of lines and set the export file to
➜ nef carbon --project TutorialCarbon.app --output ~/Desktop/snippets --background bow --size 3 --show-lines false
Step 4: Customize your snippets
Go back to Carbon Integration to read more about these and other parameters you can use :)