mardi 2 août 2016

add Strings to a var pickerDataSource : [String] = [String]()

I integrated a UIPickerView in my view and I want to add Strings dynamically.

here is my var declaration

var pickerDataSource : [String] = [String]()

how do I add String in a for statement ? such as

            for anItem in json as! [Dictionary<String, AnyObject>] {
            let nom = anItem["nom"] as! String
            let prenom = anItem["prenom"] as! String
            //add new String to pickerDataSource
}

Aucun commentaire:

Enregistrer un commentaire