From fffd99532a613ccb68f36817337fb285600d1329 Mon Sep 17 00:00:00 2001 From: mahal raskin Date: Wed, 10 Apr 2024 18:04:25 +0200 Subject: [PATCH] Minor adjustments to documentation --- Sources/AudioKitUI/Controls/ADSRView.swift | 1 + Sources/AudioKitUI/Helpers/MorphableShape.swift | 7 +++---- .../SpectrogramFlatView/UIColor+intermediate.swift | 12 ++++++++---- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/Sources/AudioKitUI/Controls/ADSRView.swift b/Sources/AudioKitUI/Controls/ADSRView.swift index 4ee9d1a..02dfbf5 100644 --- a/Sources/AudioKitUI/Controls/ADSRView.swift +++ b/Sources/AudioKitUI/Controls/ADSRView.swift @@ -7,6 +7,7 @@ import AVFoundation import UIKit /// A click and draggable view of an ADSR Envelope (Atttack, Decay, Sustain, Release) +/// /// All values are normalised 0->1, so scale them how you would like in your callback @IBDesignable public class ADSRView: UIView { diff --git a/Sources/AudioKitUI/Helpers/MorphableShape.swift b/Sources/AudioKitUI/Helpers/MorphableShape.swift index 0889ed9..e431133 100644 --- a/Sources/AudioKitUI/Helpers/MorphableShape.swift +++ b/Sources/AudioKitUI/Helpers/MorphableShape.swift @@ -31,17 +31,16 @@ struct MorphableShape: Shape { } } -// MARK: Path extension - +/// Return points at a given offset and create AnimatableVector for control points extension Path { - // return point at the curve + /// return point at the curve func point(at offset: CGFloat) -> CGPoint { let limitedOffset = min(max(offset, 0), 1) guard limitedOffset > 0 else { return cgPath.currentPoint } return trimmedPath(from: 0, to: limitedOffset).cgPath.currentPoint } - // return control points along the path + /// return control points along the path func controlPoints(count: Int) -> AnimatableVector { var retPoints = [Double]() for index in 0 ..< count { diff --git a/Sources/AudioKitUI/Visualizations/SpectrogramFlatView/UIColor+intermediate.swift b/Sources/AudioKitUI/Visualizations/SpectrogramFlatView/UIColor+intermediate.swift index fb41b54..a33b17e 100644 --- a/Sources/AudioKitUI/Visualizations/SpectrogramFlatView/UIColor+intermediate.swift +++ b/Sources/AudioKitUI/Visualizations/SpectrogramFlatView/UIColor+intermediate.swift @@ -5,11 +5,15 @@ import Foundation import UIKit -/// usage You can use it to get an intermediate color between two or more colors: -/// let color = [.green, .yellow, .red].intermediate(0.7) -/// inspired by -/// https://stackoverflow.com/questions/15032562/ios-find-color-at-point-between-two-colors/59996029#59996029 +/// Get an intermediate color between two or more colors +/// +/// Example: `let color = [.green, .yellow, .red].intermediate(0.7)` +/// +/// inspired by [stackoverflow 15032562 answer Nikaaner](https://stackoverflow.com/questions/15032562/ios-find-color-at-point-between-two-colors/59996029#59996029) extension Array where Element: UIColor { + /// Get an intermediate color between two or more colors + /// + /// Example: `let color = [.green, .yellow, .red].intermediate(0.7)` public func intermediate(_ percentage: CGFloat) -> UIColor { let percentage = Swift.max(Swift.min(percentage, 1), 0) switch percentage {