Key
public struct Key: Codable, Equatable, Hashable, ExpressibleByStringLiteral, CustomStringConvertible
Represents the keys that notes and pitches are based on.
-
Type of the key.
Declaration
Swift
public var type: KeyType
-
Accidental of the key.
Declaration
Swift
public var accidental: Accidental
-
All notes in an octave with sharp notes.
Declaration
Swift
public static let keysWithSharps = [
-
All notes in an octave with flat notes.
Declaration
Swift
public static let keysWithFlats = [
-
Initilizes the key with its type and accidental.
Declaration
Swift
public init(type: KeyType, accidental: Accidental = .natural)
Parameters
type
The type of the key.
accidental
Accidental of the key. Defaults natural.
-
Declaration
Swift
public typealias StringLiteralType = String
-
Initilizes with a string.
Declaration
Swift
public init(stringLiteral value: Key.StringLiteralType)
Parameters
value
String representation of type.
-
Returns the key notation with its type and accidental, if has any.
Declaration
Swift
public var description: String