CocoaPods trunk is moving to be read-only. Read more on the blog, there are 17 months to go.

Casper 0.2.0

Casper 0.2.0

TestsTested
LangLanguage SwiftSwift
License MIT
ReleasedLast Release Jan 2017
SwiftSwift Version 3.0
SPMSupports SPM

Maintained by Dhiraj Jadhao.



 
Depends on:
Eureka~> 2.0.0-beta.1
Nuke-FLAnimatedImage-Plugin>= 0
QRCode>= 0
 

Casper 0.2.0

  • By
  • Dhiraj Jadhao

Casper

casper

Casper is a lightweight and highly customisable framework which extends the usability of UIAlertController to provide you with much more customisable and frequently required UI elements.

Overview

Contents

Requirements

  • iOS 9.0+
  • Xcode 8+
  • Swift 3

Example project

You can clone and run the Example project to see examples of most of Casper’s features.

Usage

How to create an Alert with UICasperController

import Casper

class MyViewController: UIViewController {

override func viewDidLoad() {
super.viewDidLoad()

let casperController = UICasperController(title: "Title", message: "Message", preferredStyle: UICasperControllerStyle.alert)

casperController.addAction(title: "Volume", style: UICasperActionStyle.slider, options: nil, value: nil) { (value) in

}

casperController.present(inViewController: self, animated: true, completion: nil)
}
}

Here we created an instance of casper controller and added casper controller action to it of style Slider. You can create controller in this way and add an actions of different styles to it.

Every action comes with its handler which gets called when there is change in value.

UICasperControllerStyle

Casper supports following styles same as UIAlertController

  • Alert
let casperController = UICasperController(title: "Title", message: "Message", preferredStyle: UICasperControllerStyle.alert)
  • ActionSheet
let casperController = UICasperController(title: "Title", message: "Message", preferredStyle: UICasperControllerStyle.actionSheet)

UICasperActionStyle

Casper supports following Action Styles

  • SwitchToggle
  • Label
  • Segment
  • Check
  • Slider
  • Stepper
  • TextView
  • TextField
  • URLField
  • IntField
  • PhoneField
  • PasswordField
  • EmailField
  • ZipcodeField
  • Date
  • Time
  • DateTime
  • Button
  • Activity
  • QRCode
  • Image
  • GIFActivity

Action Catalog

Here all actions all listed with their description and with type of options they support for customisation and type of value they returns.

SwitchToggle

This adds Switch to casper.

options: nil
value: bool

Label

This adds Label to casper.

options: nil
value: String

Segment

This adds Segment control to casper.

options: Array of string option
value: String

e.g options = [“One”, “Two”, “Three”]

Check

This adds Check mark row to casper.

options: nil
value: Bool

Slider

This adds Slider to casper.

options: [minValue, maxValue]
value: Float

e.g options = [0, 5] where 0 is minumum value and 5 is maximum value.

Stepper

This adds Stepper to casper.

options: [minValue, maxValue, stepValue]
value: Double

e.g options = [0, 5, 0.5] where 0 is minumum value and 5 is maximum value and 0.5 is the step value.

TextView

This adds TextView to casper.

options: nil
value: String

TextField

This adds TextField to casper.

options: nil
value: String

URLField

This adds URLField to casper.

options: nil
value: URL

IntField

This adds IntField to casper.

options: nil
value: Int

PhoneField

This adds PhoneField to casper.

options: nil
value: String

PasswordField

This adds PasswordField to casper.

options: nil
value: String

EmailField

This adds EmailField to casper.

options: nil
value: String

ZipcodeField

This adds EmailField to casper.

options: nil
value: String

Date

This adds Date to casper.

options: nil
value: Date