Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Hard Drugs for Playgrounds: nef

Hard Drugs for Playgrounds: nef

If you want to write a new library, blog post, a book, or the README for your repository, you will encounter the same problem, how can you keep these in sync with your code? nef solves this problem using Xcode Playgrounds.

This presentation will be a live session, where together, we will write documentation using Xcode Playgrounds, following Apple’s guidelines. Your documentation will be converted into a post, or even in a microsite, and it will be verified before for publishing.

47 Degrees Academy

February 04, 2022
Tweet

More Decks by 47 Degrees Academy

Other Decks in Programming

Transcript

  1. Hard drugs for Playgrounds nef Miguel Ángel Díaz-López Senior Software

    Engineer at 47degrees @miguelangel_dl @miguelangel_dl | #AltConfMadrid | @bow_swift
  2. 1. Headers # This is an <h1> tag This is

    an <h2> tag This is an <h3> tag @miguelangel_dl | #AltConfMadrid | @bow_swift
  3. 2. Lists * Line 1 * Line 1 a *

    Line 1 b * Line 2 @miguelangel_dl | #AltConfMadrid | @bow_swift
  4. 3. Quotes > This is a quote example where we

    put emphasis in this `element` @miguelangel_dl | #AltConfMadrid | @bow_swift
  5. 4. Emphasis *This text will be italic _This will also

    be italic_ This text will be bold This will also be bold _You can combine them_ @miguelangel_dl | #AltConfMadrid | @bow_swift
  6. Markup for playgrounds : line of text with optional markup

    … line of text with optional markup : This is a single comment @miguelangel_dl | #AltConfMadrid | @bow_swift
  7. import Bow let either = Either<Error, String>.right("Either") either.fold( { _

    in "Default" }, { input in "Great \(input)!" } ) Great Either! @miguelangel_dl | #AltConfMadrid | @bow_swift
  8. : > Bow provides us functional programming in Swift import

    Bow : Either Sum type of types `A` and `B`. Represents a value of either one of those types, but not both at the same time. Values of type `A` are called left ; values of type `B` are called right . let either = Either<Error, String>.right("Either") either.fold( { _ in "Default" }, { input in "Great \(input)!" } ) Great Either! @miguelangel_dl | #AltConfMadrid | @bow_swift
  9. What is nef? "A set of command line tools that

    lets you have compile time veri cation of your documentation written as Xcode Playground" @miguelangel_dl | #AltConfMadrid | @bow_swift
  10. Eases the creation of Xcode Playgrounds with support for third

    party libraries. @miguelangel_dl | #AltConfMadrid | @bow_swift
  11. Compiles Xcode Playgrounds with support for third party libraries from

    the command line. @miguelangel_dl | #AltConfMadrid | @bow_swift
  12. Eases the creation of Xcode Playgrounds nef playground name AltConf2019

    podfile bow podfile @miguelangel_dl | #AltConfMadrid | @bow_swift
  13. Pod le target 'AltConf2019' do platform :ios, 12.0 use_frameworks! pod

    "Bow", " 0.4.0" end @miguelangel_dl | #AltConfMadrid | @bow_swift
  14. Installing Playground (AltConf2019) Set AltConf2019 target to iOS Updating podfile

    (bow podfile) Installing Pods @miguelangel_dl | #AltConfMadrid | @bow_swift
  15. Installing Pods Building AltConf2019.xcworkspace (AltConf2019) Copy frameworks Found 2 playgrounds

    Compiling Markup Formatting Reference.xcplaygroundpage Compiling Example.xcplaygroundpage @miguelangel_dl | #AltConfMadrid | @bow_swift
  16. Jekyll Integration Transform your plain text into static websites and

    blogs @miguelangel_dl | #AltConfMadrid | @bow_swift
  17. nef commands nef provides some commands to modify the Markdown

    transformation process. nef:begin:header <Jekyll's header> nef:end nef:begin:hidden import UIKit This will be hidden in the Markdown file nef:end @miguelangel_dl | #AltConfMadrid | @bow_swift
  18. Outline 1. Mardown: quick review 2. What is nef? 3.

    What can I do with nef? 4. Markdown support 5. Jekyll Integration 6. Closing the circle: CI & CD @miguelangel_dl | #AltConfMadrid | @bow_swift
  19. Parser Creates a valid AST from Xcode Playground's page 1.

    Lexical analyzer the nef's tokenizer (scanner) 2. Syntax analyzer build the AST @miguelangel_dl | #AltConfMadrid | @bow_swift