AKPropertySlider

@IBDesignable open class AKPropertySlider: UIView

Simple slider interface for AudioKit properties

  • Current value of the slider

    Declaration

    Swift

    @IBInspectable open var value: Double = 0
  • Minimum, left-most value

    Declaration

    Swift

    @IBInspectable open var minimum: Double = 0
  • Maximum, right-most value

    Declaration

    Swift

    @IBInspectable open var maximum: Double = 1
  • Text shown on the slider

    Declaration

    Swift

    @IBInspectable open var property: String = "Property"
  • Format for the number shown on the slider

    Declaration

    Swift

    @IBInspectable open var format: String = "%0.3f"
  • Background color

    Declaration

    Swift

    @IBInspectable open var bgColor: UIColor = UIColor(colorLiteralRed: 0.9, green: 0.9, blue: 0.9, alpha: 1)
  • Slider overlay color

    Declaration

    Swift

    @IBInspectable open var sliderColor: UIColor = .red
  • Text color

    Declaration

    Swift

    @IBInspectable open var textColor: UIColor = .black
  • Font size

    Declaration

    Swift

    @IBInspectable open var fontSize: CGFloat = 24
  • Function to call when value changes

    Declaration

    Swift

    open var callback: ((Double) -> Void)?
  • Initialize the slider

    Declaration

    Swift

    public init(property: String,
                    format: String = "%0.3f",
                    value: Double,
                    minimum: Double = 0,
                    maximum: Double = 1,
                    color: UIColor = UIColor.red,
                    frame: CGRect = CGRect(x: 0, y: 0, width: 440, height: 60),
                    callback: @escaping (_ x: Double) -> Void)
  • Initialization with no details

    Declaration

    Swift

    override public init(frame: CGRect)
  • Initialization within Interface Builder

    Declaration

    Swift

    required public init?(coder: NSCoder)
  • Actions to perform to make sure the view is renderable in Interface Builder

    Declaration

    Swift

    override open func prepareForInterfaceBuilder()
  • Require constraint-based layout

    Declaration

    Swift

    open class override var requiresConstraintBasedLayout: Bool
  • Handle new touches

    Declaration

    Swift

    override open func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?)
  • Handle moved touches

    Declaration

    Swift

    override open func touchesMoved(_ touches: Set<UITouch>, with event: UIEvent?)
  • Give the slider a random value

    Declaration

    Swift

    open func randomize() -> Double
  • Draw the slider

    Declaration

    Swift

    override open func draw(_ rect: CGRect)