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

MentalDice-Swift 1.3.0

MentalDice-Swift 1.3.0

Maintained by Guillaume Bellut.



  • By
  • Guillaume Bellut

MentalDice-Swift

Installation

Pod setup

  1. Add source 'https://github.com/DodyMagic/mentaldice_swift.git' on top of your Podfile

  2. Add pod 'MentalDice-Swift' into your Podfile targets

  3. Run pod install

Usage

  1. Init a list of dice variable from Mental Dice framework: var dice = MentalDice.shared.dice

  2. Set yourself as delegate: MentalDice.shared.delegate = self

  3. Connect to the Mental Dice: MentalDice.shared.connect()

  4. Listen to the delegate protocol:

extension YourClass: MentalDiceDelegate {
    func didUpdate(dice: [Die]) {
        self.dice = dice
    }

    func didDetect(color: Die.Color) {
        // ...
    }

    func didConnect() {
        // ...
    }

    func didDisconnect() {
        // ...
    }
}