Section
struct Section: Identifiable, Equatable, Codable
A section in the Song
-
The unique ID of the section
Declaration
Swift
var id: Int -
The label of the section
Declaration
Swift
var label: String = "" -
The
Environment typeof the sectionDeclaration
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
TaborGridwhen 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’ itDeclaration
Swift
mutating func addWarning(_ warning: String) -
Reset all the warnings
Declaration
Swift
mutating func resetWarnings() -
Declaration
Swift
struct Line: Identifiable, Equatable, Codable
View on GitHub