Latest 0.1.0
Homepage https://github.com/ryohey/Fader
License MIT
Platforms ios 9.0
Frameworks UIKit
Authors

CI Status
Version
License
Platform

many faders

video

Fader is a lightweight controller library for Swift heavily inspired by dat.gui.

Code Example

let fader = Fader(frame: .zero)

fader.add(target: particle,
          keyPath: SCNParticleSystem.birthRate,
          minValue: 0.0,
          maxValue: 1000.0)

By new KeyPath syntax of Swift 4, we can describe it type-safely and shortly.

Usage

image

  1. Add Fader view to your screen
  2. Add x, y, width constraints
  3. Add codes to specify properties to modify

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Installation

Fader is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod 'Fader'

KeyPath API

Since pure swift class can not get the name from KeyPath, use the label parameter.

Number

fader.add(target: car,
          keyPath: Car.speed,
          minValue: 0.0,
          maxValue: 120.0)

Boolean

fader.add(target: door,
          keyPath: Door.isClosed)

String

fader.add(target: label,
          keyPath: UILabel.text)

Callback API

Specify initialValue to set the initial value with Callback API.

Number

fader.add(label: "strength", minValue: 0.0, maxValue: 100) { (value: Double) in
    self.attackStrength = value
}

Boolean

fader.add(label: "on off") { (isOn: Bool) in
    self.switch.isOn = isOn
}

String

fader.add(label: "name") { (str: String?) in
    self.nameLabel.text = str
}

Author

ryohey, [email protected]

License

Fader is available under the MIT license. See the LICENSE file for more info.

Latest podspec

{
    "name": "Fader",
    "version": "0.1.0",
    "summary": "A graphical user interface for changing variables in Swift.",
    "description": "Fader is a lightweight controller library for Swift heavily inspired by dat.gui.",
    "homepage": "https://github.com/ryohey/Fader",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "ryohey": "[email protected]"
    },
    "source": {
        "git": "https://github.com/ryohey/Fader.git",
        "tag": "0.1.0"
    },
    "platforms": {
        "ios": "9.0"
    },
    "source_files": "Fader/Classes/**/*",
    "frameworks": "UIKit"
}

Pin It on Pinterest

Share This