This will help you animate the DualShock 4 controller's light color as seen in this session.
- Create a file in your project called
ControllerAnimatable.swift
and paste the code from below into it. - Make your ViewController adopt the ControllerAnimatable protocol
- Add
controller
variable which will return the currentGCController
, you are responsible for handling, Example:var controller: GCController { GCController.current! }
. Note that if you already have stored controller property just return it in thecontroller
's getter, like herevar controller: GCConotroller { myController }
.
Call animate(to:duration:completion:)
to animate the controller's light color.
Awesome snippet! Excited to see how this progresses