jpsim / JPSVolumeButtonHandler

JPSVolumeButtonHandler provides an easy block interface to hardware volume buttons on iOS devices. Perfect for camera apps!
MIT License
333 stars 90 forks source link

any swift examples? #6

Open gbertb opened 9 years ago

gbertb commented 9 years ago

Would love to see how this can be implemented in swift

lucatorella commented 8 years ago

It's straightforward to use it in Swift. Declare a property in your VC:

var volumeButtonHandler: JPSVolumeButtonHandler?

in viewDidLoad() set the property with the 2 blocks:

let block = { () -> Void in doSomething }
volumeButtonHandler = JPSVolumeButtonHandler(upBlock: block, downBlock: block)
kronik commented 7 years ago

Take a look on PhysicalButton