简体   繁体   中英

IF Statement && Swift for Passing Data in Tableview

i want to pass multi data in tableview. if 1 data its work, but i will try to multi data.

how?

this my syntax but its not work

override func viewWillAppear(_ animated: Bool) {
    super.viewWillAppear(animated)

    if let namaToko = namaToko && let lokasi = lokasi && let notelp = notelp {

        lblNamaToko.text = namaToko
        lblNoTelp.text = notelp
        lblLokasi.text = lokasi


    }

}

please help how must i do ?

Unwrap your data first then assign to your variables or outlets.

if let namaToko = namaToko, let lokasi = lokasi, let notelp = notelp {    
  lblNamaToko.text = namaToko
  lblNoTelp.text = notelp
  lblLokasi.text = lokasi
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM