我有一个带有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)
}
}