can’t convert string into int to display on label

import UIKit
class cuenta: UIViewController {

    @IBOutlet weak var displaytotal: UILabel!
    @IBOutlet weak var display: UILabel!
    var cubitoCHocolate: String!
    var cubitoCoco: String!
    var cubitoCacahuate: String!
    var cubitoFresa: String!
    var cubitoNaranja: String!
    var cubitoMango: String!
    var cuentaDeCubitos = String /*Expected member name or constructor call after type name*/


    override func viewDidLoad() {
        super.viewDidLoad()
  
        cuentaDeCubitos = cubitoCHocolate + cubitoCoco + cubitoCacahuate + cubitoFresa + cubitoNaranja + cubitoMango /*Expected member name or constructor call after type name*/

        display.text = "Tu pedido:" + "n" + "Chocolate: "+cubitoCHocolate+"n"+"Coco: "+cubitoCoco+"n"+"Cacahuate: "+cubitoCacahuate+"n"+"Fresa: "+cubitoFresa+"n"+"Naranja: "+cubitoNaranja+"n"+"Mango: "+cubitoMango
       if Int(cuentaDeCubitos) >= 1 { /*Cannot invoke initializer for type 'Int' with an argument list of type '(String.Type)'*/
            displaytotal.text = Int(cuentaDeCubitos) * 6 /*Cannot invoke initializer for type 'Int' with an argument list of type '(String.Type)'*/

        }
       else {
        displaytotal.text = "0"
        }
    }

can’t convert string into integer to show in my label call ‘displaytotal’ i try many diferrents ways to fix it by readding the forum but i simple can’t plz help

Powered by WPeMatico

About

You may also like...

Comments are closed.