Skip to content
This repository has been archived by the owner on Dec 29, 2020. It is now read-only.

Commit

Permalink
Update comments for docs
Browse files Browse the repository at this point in the history
  • Loading branch information
gizmosachin committed Apr 14, 2016
1 parent 0bd32c3 commit 17455a4
Showing 1 changed file with 5 additions and 37 deletions.
42 changes: 5 additions & 37 deletions Source/ColorSlider.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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 }
Expand All @@ -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 }
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 17455a4

Please sign in to comment.