This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func midiNumberToKey(midiNote: MIDINoteNumber)-> String { | |
let keys = ["C","C#","D","D#","E","F","F#","G","G#","A","A#","B"]; | |
let note = Int(midiNote) | |
return keys[note % 12] + " \(Int(floor(note / 12)))" | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension UIView { | |
func prideColors(){ | |
// Offical colors | |
let colors = [UIColor(red:0.91, green:0.00, blue:0.00, alpha:1.0),UIColor(red:1.00, green:0.55, blue:0.00, alpha:1.0), UIColor(red:1.00, green:0.94, blue:0.00, alpha:1.0),UIColor(red:0.00, green:0.51, blue:0.12, alpha:1.0),UIColor(red:0.00, green:0.27, blue:1.00, alpha:1.0),UIColor(red:0.46, green:0.00, blue:0.54, alpha:1.0)] | |
for (index,color) in colors.enumerated() { | |
let gradient = CAGradientLayer() | |
gradient.frame = CGRect(x: (Int(self.bounds.width)/6)*index, y: 0, width: Int(self.bounds.width), height: Int(self.bounds.height)) | |
gradient.colors = [color.cgColor, color.cgColor] | |
self.layer.addSublayer(gradient) | |
} |