title: How to format a Double into Currency - Swift 3
body: <p>I'm new to Swift programming and I've been creating a simple tip calculator app in Xcode 8.2, I have my calculations set up within my <code>IBAction</code> below. But when I actually run my app and input an amount to calculate (such as 23.45), it comes up with more than 2 decimal places. How do I format it to <code>.currency</code> in this case?</p>
  
  <pre><code>@IBAction func calculateButtonTapped(_ sender: Any) {
  
      var tipPercentage: Double {
  
          if tipAmountSegmentedControl.selectedSegmentIndex == 0 {
              return 0.05
          } else if tipAmountSegmentedControl.selectedSegmentIndex == 1 {
              return 0.10
          } else {
              return 0.2
          }
      }
  
      let billAmount: Double? = Double(userInputTextField.text!)
  
      if let billAmount = billAmount {
          let tipAmount = billAmount * tipPercentage
          let totalBillAmount = billAmount + tipAmount
  
          tipAmountLabel.text = "Tip Amount: $\(tipAmount)"
          totalBillAmountLabel.text = "Total Bill Amount: $\(totalBillAmount)"
      }
  }
  </code></pre>