I want to show plist content into a table view, but Xcode crashed.
This is my code to get plist data :
var tableData = [String]()
override func viewDidLoad() {
super.viewDidLoad()
self.tblMain.delegate = self
self.tblMain.dataSource = self
let path = Bundle.main.path(forResource: "Province", ofType: "plist")!
let dict = NSDictionary(contentsOfFile: path)
tableData = dict!.object(forKey: "root") as! [String]
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "cell") as! CountryNameCell
cell.lblCountryName.text = tableData[indexPath.row]
return cell
}
This is my plist file :