So im trying to learn Swift and used a video to build my first app after learning a bit with Hackingwithswift 100 days Swift. I made everything like in the video, but still get an error im not capable of handling. Maybe one of you could help!
I get this Error: Thread 1: Exception: "[<SalesTax.ViewController 0x7fb0cec08d30> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key pricetxt."
This is my code:
import UIKit
class ViewController: UIViewController {
@IBOutlet weak var priceTxt: UITextField!
@IBOutlet weak var salesTaxTxt: UITextField!
@IBOutlet weak var totalPriceLbl: UILabel!
override func viewDidLoad() {
super.viewDidLoad()
totalPriceLbl.text = ""
}
@IBAction func calculateTotalPrice(_ sender: Any) {
let price = Double(priceTxt.text!)!
let salesTax = Double(salesTaxTxt.text!)!
let totalSalesTax = price * salesTax
let totalPrice = price + totalSalesTax
totalPriceLbl.text = "$\(totalPrice)"
}
}
the compiler only shows the error after im trying to run it. The emulator starts, but the app keeps blank (just a white page)