Latest 0.0.1
Homepage https://github.com/cemolcay/Fretboard
License MIT
Platforms ios 9.0, osx 10.9, tvos 9.0, requires ARC
Dependencies MusicTheorySwift, CenterTextLayer
Authors

Customisable guitar fretboard view for iOS, tvOS and macOS with CoreGraphics.

Demo

Mac

alt tag

alt tag

iOS

alt tag

Apple TV

alt tag

Storyboard

alt tag

Requierments

  • Swift 3.0+
  • iOS 8.0+
  • tvOS 9.0+
  • macOS 10.9+

Install

use_frameworks!
pod 'Fretboard'

Usage

Create a FretboardView, subclass of UIView with code or from storyboard.

Note selection

Fretboard uses MusicTheory library to render scales, chords or notes.
You need to select/unselect notes, chords or scales on fretboard property of your FretboardView instance.

let chord = Chord(type: .maj, key: .a)
fretboardView?.fretboard.select(chord: chord)

let scale = Scale(type: .major, key: .e)
fretboardView?.fretboard.select(scale: scale)

let note = Note(type: .a, octave: 2)
fretboardView?.fretboard.select(note: note)

fretboardView?.fretboard.unselect(note: note)
fretboardView?.fretboard.unselectAll()

You could also set isChordModeOn property to true, if you want the render only lowest pitch on a string.
I recommend 3, 4 or 5 frets to use that feature.

Tuning

Fretboard has a neat tuning property which is a FretboardTuning enum, lets you define strings and their reprented notes on fretboard.
It has a bunch of premade tuning for guitar, bass and ukelele.
You can define custom tunings with custom string count as well.

let tuning = FretboardTuning.custom(tuning: [
  Note(type: .g, octave: 2),
  Note(type: .d, octave: 2),
  Note(type: .a, octave: 1),
  Note(type: .e, octave: 1)
])
fretboardView?.fretboard.tuning = tuning

Direction

You could render fretboard either horizontal or vertical with direction property on fretboard of type FretboardDirection.

freboardView?.fretboard.direction = .horizontal
freboardView?.fretboard.direction = .vertical

Frets

You could render any range of fretboard with startIndex and count properties on fretboard.
startIndex is the start fret and 0 is open string, defaults 0.
count is the fret count and defaults 5.

Customisation

You could change the line widths and colors of frets and strings.
You could change the colors of fret numbers, string names, notes from code or storyboard.
Rendering note names on pressed notes and optional.
Also rendering fret numbers and strings names are optional too.
See the properties of FretboardView.

Latest podspec

{
    "name": "Fretboard",
    "version": "0.0.1",
    "summary": "Customisable guitar fretboard view for iOS, tvOS and macOS with CoreGraphics",
    "description": "Fretboardn===nnCustomisable guitar fretboard view for iOS, tvOS and macOS with CoreGraphics.nnDemon----nn#### Macnn![alt tag](https://github.com/cemolcay/Fretboard/blob/master/Examples/mac_horizontal.png?raw=true)nn![alt tag](https://github.com/cemolcay/Fretboard/blob/master/Examples/mac_vertical.png?raw=true)nn#### iOSnn![alt tag](https://github.com/cemolcay/Fretboard/blob/master/Examples/ios.png?raw=true)nn#### Apple TVnn![alt tag](https://github.com/cemolcay/Fretboard/blob/master/Examples/tv.png?raw=true)nn#### Storyboardnn![alt tag](https://github.com/cemolcay/Fretboard/blob/master/Examples/ib.png?raw=true)nnRequiermentsn----nn* Swift 3.0+n* iOS 8.0+n* tvOS 9.0+n* macOS 10.9+nnInstalln----nn```nuse_frameworks!npod 'Fretboard'n```nnUsagen----nnCreate a `FretboardView`, subclass of `UIView` with code or from storyboard.nFretboard uses `[MusicTheory](https://github.com/cemolcay/MusicTheory)` library to render scales, chords or notes.nYou need to select/unselect notes, chords or scales on `fretboard` property of your `FretboardView` instance.nn```nlet chord = Chord(type: .maj, key: .a)nfretboardView?.fretboard.select(notes: chord)nnlet scale = Scale(type: .major, key: .e)nfretboardView?.fretboard.select(scale: scale)nnlet note = Note(type: .a, octave: 2)nfretboardView?.fretboard.select(note: note)nnfretboardView?.fretboard.unselect(note: note)nfretboardView?.fretboard.unselectAll()n```nn#### TuningnnFretboard has a neat tuning property which is a `FretboardTuning` enum, lets you define strings and their reprented notes on fretboard.nIt has a bunch of premade tuning for guitar, bass and ukelele.nYou can define custom tunings with custom string count as well.nn```nlet tuning = FretboardTuning.custom(tuning: [nNote(type: .g, octave: 2),nNote(type: .d, octave: 2),nNote(type: .a, octave: 1),nNote(type: .e, octave: 1)n])nfretboardView?.fretboard.tuning = tuningn```nn#### DirectionnnYou could render fretboard either horizontal or vertical with `direction` property on fretboard of type `FretboardDirection`.nn```nfreboardView?.fretboard.direction = .horizontalnfreboardView?.fretboard.direction = .verticaln```nn#### FretsnnYou could render any range of fretboard with `startIndex` and `count` properties on fretboard.n`startIndex` is the start fret and 0 is open string, defaults 0.n`count` is the fret count and defaults 5.nn#### CustomisationnnYou could change the line widths and colors of frets and strings.nYou could change the colors of fret numbers, string names, notes from code or storyboard.nRendering note names on pressed notes and optional.nAlso rendering fret numbers and strings names are optional too.nSee the properties of `FretboardView`.",
    "homepage": "https://github.com/cemolcay/Fretboard",
    "license": "MIT",
    "authors": {
        "cemolcay": "[email protected]"
    },
    "social_media_url": "http://twitter.com/cemolcay",
    "platforms": {
        "ios": "9.0",
        "osx": "10.9",
        "tvos": "9.0"
    },
    "source": {
        "git": "https://github.com/cemolcay/Fretboard.git",
        "tag": "0.0.1"
    },
    "source_files": "Source/*.swift",
    "requires_arc": true,
    "dependencies": {
        "MusicTheorySwift": [],
        "CenterTextLayer": []
    },
    "pushed_with_swift_version": "3.0"
}

Pin It on Pinterest

Share This