blob: de249b60e16568d35998b451d7b7996ec0be6a46 [file] [log] [blame]
{
"name": "SwiftyKnob",
"version": "0.0.9",
"summary": "An easy way to add knobs in your app",
"description": "# SwiftyKnob\n\n[![Version](https://img.shields.io/cocoapods/v/SwiftyKnob.svg?style=flat)](http://cocoapods.org/pods/SwiftyKnob)\n![Swift 3.0.x](https://img.shields.io/badge/Swift-3.0.x-orange.svg)\n\nSwiftyKnob allows you to easily add knobs in your iOS apps. If you are unfamiliar with knobs, they are basically curved progress bars. You can use them to show profile completion, stats or just about anything else!\n\nHere's what it looks like:\n\n<img alt=\"SwiftyKnob demo\" src=\"https://github.com/jevin/SwiftyKnob/blob/master/images/SwiftyKnob.gif\" width=400 />\n\n## Installation\n\n**Via [Cocoapods](https://cocoapods.org/)**\n\n```ruby\npod \"SwiftyKnob\"\n```\n\n**Manually**\n\nJust drag the `Knob.swift` in `SwiftyKnob/Classes/` to your project tree and you're ready to go.\n\n## Usage\n\n### In code\n\n```swift\nlet knob = Knob(frame: CGRect(x: 8, y: 20, width: 100, height: 100),\n borderWidth: 18,\n borderColor: UIColor.red,\n value: 0.78, \n text: \"78%\",\n description: \"open rate\"\n)\n\nview.addSubview(knob)\n```\nSimply initialize the `Knob` class with the wanted parameters and add it to the view. The knob will animate automatically when needed. \n\nFor a detailed description of the `Knob` initializer see the following table:\n\nParameter | Description\n--- | ---\nframe | The rectangle defining the size and position of the knob\nborderWidth | The width of the knob's border\nborderColor | The color of the above border\nvalue | The value of the knob. Should be between 0.0 and 1.0\ntext | The main text, displayed at the center of the knob\ndescription | A smaller description, displayed below the text above\n\n#### Controlling animations\nBy default, the knob animates as soon as it's drawn. If you want to control that, you can use the follwing code:\n\n```swift\nlet knob = Knob(frame: CGRect(x: 8, y: 20, width: 100, height: 100),\n borderWidth: 18,\n borderColor: UIColor.red,\n value: 0.78, \n text: \"78%\",\n description: \"open rate\",\n autoAnimate: false\n)\n```\nThe last parameter tells SwiftyKnob **not** to animate the knob when it's drawn. You can then use the following line to fire the animation.\n\n```swift\nknob.animate()\n```\n**Note:** Calling `animate` inside `viewDidLoad` will not work. Instead you should call it in `viewDidAppear`.\n\n### In storyboards\n\n1. Add a `UIView` to your scene\n\n2. Make `Knob` the custom class of your view\n\n![Image 1](https://github.com/jevin/SwiftyKnob/blob/master/images/storyboard-1.png)\n\n3. Customize your knob using the exposed attributes\n\n![Image 2](https://github.com/jevin/SwiftyKnob/blob/master/images/storyboard-2.png)\n\n## Contributing\n\n1. Fork it!\n2. Create your feature branch: `git checkout -b my-new-feature`\n3. Commit your changes: `git commit -am 'Add some feature'`\n4. Push to the branch: `git push origin my-new-feature`\n5. Submit a pull request\n\n## Credits\n\nThanks to [@mikedev](https://twitter.com/mikedev) for his [awesome answer](http://stackoverflow.com/questions/26578023/animate-drawing-of-a-circle/26578895#26578895) on StackOverflow about `CAShapeLayer` and `CABasicAnimation`!\n\n## License\n\nSwiftyKnob is available under the MIT License. See the LICENSE file for more info.\n\nIf you like what I do, you should follow me on Twitter: [@jevinsew](https://twitter.com/jevinsew/) ✌️",
"homepage": "https://github.com/jevin/SwiftyKnob.git",
"license": "MIT",
"authors": {
"jevin": "jevin9@gmail.com"
},
"social_media_url": "http://twitter.com/jevinsew",
"platforms": {
"ios": "8.0"
},
"source": {
"git": "https://github.com/jevin/SwiftyKnob.git",
"tag": "0.0.9"
},
"source_files": "SwiftyKnob/Classes/**/*",
"pushed_with_swift_version": "3.1"
}