title: Swift 3 Xcode: How to display battery levels as an integer?
body: <p>I am making an app to read battery percentage using Swift!
  Right now my out is something like this:
  61.0% or 24.0% or 89.0%
  What I'm trying to fix is getting rid of the .0 so it's an Int.
  This is my code so far:</p>
  
  <pre><code>import UIKit
  
  class ViewController: UIViewController {
  
  @IBOutlet weak var infoLabel: UILabel!
  
  var batteryLevel: Float {
      return UIDevice.current.batteryLevel
  }
  
  var timer = Timer()
  
  func scheduledTimerWithTimeInterval(){
      timer = Timer.scheduledTimer(timeInterval: 60, target: self, selector: #selector(self.someFunction), userInfo: nil, repeats: true)
  }
  
  func someFunction() {
      self.infoLabel.text = "\(batteryLevel * 100)%"
  }
  
  override func viewDidLoad() {
      super.viewDidLoad()
      UIDevice.current.isBatteryMonitoringEnabled = true
      someFunction()
      scheduledTimerWithTimeInterval()
  }
  
  override func didReceiveMemoryWarning() {
      super.didReceiveMemoryWarning()
  }
  
  }
  </code></pre>
  
  <p>I have tried something like this:</p>
  
  <pre><code>var realBatteryLevel = Int(batteryLevel)
  </code></pre>
  
  <p>However, I get this <a href="https://i.stack.imgur.com/6B471.png" rel="nofollow noreferrer">error</a></p>
  
  <p>I have tried other method but none with any luck. Please, any solutions would be awesome! Thanks in advance!</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>I was considering making the float <code>batteryLevel</code> into a String and then replacing ".0" with "" and I have seen this somewhere, however, I'm not sure how!</p>