This is a pretty old example. Swift has, of course, changed. Take a look at this more modern implimentation instead
https://github.com/mopius/ble-battery-status-ios
Gets the battery level of Kontack.io iBeacons. Really useful to keep an eye on this and send alerts when the batteries are almost empty. iBeacons should last about 2 years on a single battery - depending on broadcast interval - this seems like just enough time for everyone to forget about them!
Built using Swift for iOS