无法使用Swift类型的参数列表调用类型的初始值设定项

时间:2016-08-08 18:17:10

标签: swift initialization

我有一个带有12个ViewControllers的应用程序。当我从一个ViewController转到另一个时,我将数据保存到Struct FullData。 在class TwelvethViewController中,我获取Struct FullData的内容并将它们作为参数传递给FireBaseData的实例,但是我收到错误 - 无法使用参数调用类型FireBaseData的初始值设定项类型列表`((FirePostCode:String,FireSelectedBathRow:Int))

import Foundation
  Struct FullData {
    static  var finalPostCode:String!
    static  var finalSelectedBathRow:Int!
}


struct FireBaseData {
  var FirePostCode:String!
  var FireSelectedBathRow:Int!

   init(FirePostCode:String,FireSelectedBathRow:Int){
     self.FirePostCode = FirePostCode
     self.FireSelectedBathRow = FireSelectedBathRow
 }
}


class TwelvethViewController: UIViewController {

  @IBAction func saveToDB(sender: AnyObject) {
     let fireData = FireBaseData(FirePostCode: FullData.finalPostCode,
     FireSelectedBathRow: FullData.finalSelectedBathRow)
  }
}

0 个答案:

没有答案