Add this line
totaleValue.text = "$\(Int(typPrice.text!.replacingOccurrences(of: "$", with: ""))! + Int(fruitPrice.text!.replacingOccurrences(of: "$", with: ""))!)"
in end of typesegm
and fruitSegm
method like this.
@IBAction func typesegm(_ sender: Any) {
switch typesegm.selectedSegmentIndex
{ ... }
totaleValue.text = "$\(Int(typPrice.text!.replacingOccurrences(of: "$", with: ""))! + Int(fruitPrice.text!.replacingOccurrences(of: "$", with: ""))!)"
}
@IBAction func fruitSegm(_ sender: Any) {
switch fruit.selectedSegmentIndex
{ ... }
totaleValue.text = "$\(Int(typPrice.text!.replacingOccurrences(of: "$", with: ""))! + Int(fruitPrice.text!.replacingOccurrences(of: "$", with: ""))!)"
}
solved How to Collect the numbers in Lebel text