Directive

enum Directive: DirectiveSource, CaseIterable, Identifiable, Codable

The directives Chord Provider supports

Official directives

  • Meta-data directives

    This directive defines the title of the song

    Declaration

    Swift

    case title = "title|t"
  • This directive defines a subtitle of the song

    Declaration

    Swift

    case subtitle = "subtitle|st"
  • This directive defines an artist

    Declaration

    Swift

    case artist
  • This directive defines an album this song occurs on

    Declaration

    Swift

    case album
  • The year this song was first published, as a four-digit number

    Declaration

    Swift

    case year
  • key

    This directive specifies the key the song is written in

    Declaration

    Swift

    case key
  • This directive specifies a time signature

    Declaration

    Swift

    case time
  • This directive specifies the tempo in number of beats per minute for the song

    Declaration

    Swift

    case tempo
  • This directive specifies the capo setting for the song

    Declaration

    Swift

    case capo
  • This directive specifies the instrument setting for the song

    Declaration

    Swift

    case instrument
  • Formatting directives

    This directive introduce a comment line

    Declaration

    Swift

    case comment = "comment|c"
  • Specifies the name of the file containing the image

    Declaration

    Swift

    case image
  • Environment directives

    Chorus

    This directive indicates that the lines that follow form the song’s chorus

    Declaration

    Swift

    case startOfChorus = "start_of_chorus|soc"
  • This directive indicates the end of the chorus

    Declaration

    Swift

    case endOfChorus = "end_of_chorus|eoc"
  • This directive indicates that the song chorus must be played here

    Declaration

    Swift

    case chorus
  • Verse

    Specifies that the following lines form a verse of the song

    Declaration

    Swift

    case startOfVerse = "start_of_verse|sov"
  • Specifies the end of the verse

    Declaration

    Swift

    case endOfVerse = "end_of_verse|eov"
  • Bridge

    Specifies that the following lines form a bridge of the song

    Declaration

    Swift

    case startOfBridge = "start_of_bridge|sob"
  • Specifies the end of the bridge

    Declaration

    Swift

    case endOfBridge = "end_of_bridge|eob"
  • Tab

    This directive indicates that the lines that follow form a section of guitar TAB instructions

    Declaration

    Swift

    case startOfTab = "start_of_tab|sot"
  • This directive indicates the end of the tab

    Declaration

    Swift

    case endOfTab = "end_of_tab|eot"
  • Grid

    This directive indicates that the lines that follow define a chord grid in the style of Jazz Grilles

    Declaration

    Swift

    case startOfGrid = "start_of_grid|sog"
  • This directive indicates the end of the grid

    Declaration

    Swift

    case endOfGrid = "end_of_grid|eog"
  • Delegated environment directives

    ABC

    This directive indicates that the lines that follow define a piece of music written in ABC music notation

    Declaration

    Swift

    case startOfABC = "start_of_abc"
  • This directive indicates the end of the ABC

    Declaration

    Swift

    case endOfABC = "end_of_abc"
  • Textblock

    This directive indicates that the lines that follow define a piece of text that is combined into a single object that can be placed as an image

    Declaration

    Swift

    case startOfTextblock = "start_of_textblock"
  • This directive indicates the end of the textblock

    Declaration

    Swift

    case endOfTextblock = "end_of_textblock"
  • Chord diagrams

    This directive defines a chord in terms of fret/string positions and, optionally, finger settings

    Declaration

    Swift

    case define

Output related directives

  • This directive forces a new page to be generated at the place where it occurs in the song

    Declaration

    Swift

    case newPage = "new_page|np"
  • When printing songs in multiple columns, this directive forces printing to continue in the next column

    Declaration

    Swift

    case columnBreak = "column_break|colb"

Custom directives

  • tag

    This directive defines a tag for the song

    Declaration

    Swift

    case tag
  • Strum

    This directive indicates that the lines that follow defines a strum pattern

    Declaration

    Swift

    case startOfStrum = "start_of_strum|sos"
  • This directive indicates the end of the strum

    Declaration

    Swift

    case endOfStrum = "end_of_strum|eos"

Custom metadata directives

Details of a directive

Directive extensions

  • The start and end of the directive

    Declaration

    Swift

    var format: (start: String, end: String)
  • The raw label of the directive

    Declaration

    Swift

    func label(_ directive: ChordPro.Directive) -> String

    Parameters

    directive

    The ChordPro/Directive

    Return Value

    The raw value as String

  • The kind of directive (block, inline or optional label)

    Declaration

    Swift

    var kind: Kind
  • The kind of directive (block or inline)

    See more

    Declaration

    Swift

    enum Kind

Grouped directives