oc

作者: 970517 | 来源:发表于2018-09-10 08:10 被阅读0次
    1. let s = StudenModel()

       let deal = DealData()
       
       var dictArray : [[String:String]] = []
       
       for _ in 0..<5 {
           let dict = ["name":"Lily","age":"23","gender":"nv"]
           
           dictArray.append(dict)
           
       }
       
       let arrayModel = deal.returnModelArray(arrayDict: dictArray)
       
       for model in arrayModel {
           print(model.name)
           print(model.age)
           print(model.gender)
       }
       print(arrayModel)
       
       2.
      

    protocol DealDataProticol {

    func returnModelArray(arrayDict : [[String:String]]) -> [StudenModel]
    

    }

    1. func returnModelArray(arrayDict: [[String : String]]) -> [StudenModel] {
      var array : [StudenModel] = []
      for dict in arrayDict {
      let stdent = StudenModel()
      stdent.name = dict["name"] ?? ""
      stdent.age = dict["age"]!
      stdent.gender = dict["gender"]!
            array.append(stdent)
        }
        return array
    }

    相关文章

      网友评论

          本文标题:oc

          本文链接:https://www.haomeiwen.com/subject/vtpjgftx.html