I'm getting the error stated in the title where var updater is declared.
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
if let destination = segue.destination as? ProductViewController,
let index = tableViewProducts.indexPathForSelectedRow?.row {
// Check whether postData array count is greater than index
let updaterId = postData.count > index ? postData[index] : ""
// Initialize "productsList" instance and assign the id value and sent this object to next view controller
var updater = productsList(id: String?, p_name: String?, image: String?, audio: String?)
updater.id = updaterId
destination.updater = updater
here is my productsList VC:
import Foundation
class productsList {
let id: String?
let p_name: String?
let image: String?
let audio: String?
init(id: String?, p_name: String?, image: String?, audio: String?) {
self.id = id
self.p_name = p_name
self.image = image
self.audio = audio
}
}