diff --git a/Source/ColorSlider.swift b/Source/ColorSlider.swift index 3f1ec07..424c2c1 100644 --- a/Source/ColorSlider.swift +++ b/Source/ColorSlider.swift @@ -25,47 +25,11 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. -/// Create and add an instance of ColorSlider to your view hierarchy. -/// -/// ``` Swift -/// let colorSlider = ColorSlider() -/// colorSlider.frame = CGRectMake(0, 0, 12, 150) -/// view.addSubview(colorSlider) -/// ``` -/// -/// ColorSlider is a subclass of `UIControl` and supports the following `UIControlEvents`: -/// - `.TouchDown` -/// - `.ValueChanged` -/// - `.TouchUpInside` -/// - `.TouchUpOutside` -/// - `.TouchCancel` -/// -/// You can get the currently selected color with the `color` property. -/// ``` -/// colorSlider.addTarget(self, action: "changedColor:", forControlEvents: .ValueChanged) -/// -/// func changedColor(slider: ColorSlider) { -/// var color = slider.color -/// // ... -/// } -/// ``` -/// -/// Enable live color preview: -/// ``` -/// colorSlider.previewEnabled = true -/// ``` -/// -/// Customize appearance: -/// ``` -/// colorSlider.orientation = .Horizontal -/// colorSlider.borderWidth = 2.0 -/// colorSlider.borderColor = UIColor.whiteColor() -/// ``` - import UIKit import Foundation import CoreGraphics +/// The main ColorSlider class. @IBDesignable public class ColorSlider: UIControl { /// The current color of the `ColorSlider`. public var color: UIColor { @@ -230,6 +194,7 @@ import CoreGraphics // MARK: - /// Updates the `ColorSlider` color. + /// /// - parameter touch: The touch that triggered the update. /// - parameter touchInside: A boolean value that is `true` if `touch` was inside the frame of the `ColorSlider`. private func updateForTouch(touch: UITouch, touchInside: Bool) { @@ -280,6 +245,7 @@ import CoreGraphics // MARK: - Preview /// Shows the color preview. + /// /// - parameter touch: The touch that triggered the update. private func showPreview(touch: UITouch) { if !previewEnabled { return } @@ -295,6 +261,7 @@ import CoreGraphics } /// Updates the color preview. + /// /// - parameter touch: The touch that triggered the update. private func updatePreview(touch: UITouch) { if !previewEnabled { return } @@ -332,6 +299,7 @@ import CoreGraphics } /// Calculates the transform from `rect` to the minimized preview view. + /// /// - parameter rect: The actual frame of the preview view. /// - returns: The transform from `rect` to generate the minimized preview view. private func minimizedTransformForRect(rect: CGRect) -> CGAffineTransform {