Section

struct Section: Identifiable, Equatable, Codable

A section in the Song

  • id

    The unique ID of the section

    Declaration

    Swift

    var id: Int
  • The label of the section

    Declaration

    Swift

    var label: String = ""
  • The Environment type of the section

    Declaration

    Swift

    var environment: ChordPro.Environment = .none
  • The lines in the section

    Declaration

    Swift

    var lines: [Line] = []
  • Boolean if the section is automatic created

    This happens mostly for lines with test and chords that is not surrounded by a {start_of_verse} and {end_of_verse}

    But also for a Tab or Grid when a line starts with an ‘|’

    The editor will show a warning when the section is automatically created with an assumed Environment.

    Note

    Automatically created sections will end with an ‘newline’, unlike defined sections.

    Declaration

    Swift

    var autoCreated: Bool
  • Optional warnings for this section

    Declaration

    Swift

    private(set) var warnings: Set<String>?
  • The optional arguments of the section

    Declaration

    Swift

    var arguments: ChordProParser.Arguments?
  • Note

    warnings are optionals so we can not just ‘insert’ it

    Declaration

    Swift

    mutating func addWarning(_ warning: String)
  • Reset all the warnings

    Declaration

    Swift

    mutating func resetWarnings()
  • A line in the Section

    This is a line in the source document, parsed into components

    See more

    Declaration

    Swift

    struct Line: Identifiable, Equatable, Codable