I am using NSDictionary
to get data from json and then i added the value from NSDictionary
to UITableView
.When user is selected one of the table cell it will send back the value.The point is how to get the key of selected value from table cell in NSDictionary
in Swift?
import UIKit
class ViewController: UIViewController {
var myFruits = ["0_22":"Sunkist","34_22":"Pine Apple","45_22":"Grape","1_123":"Apple"]
override func viewDidLoad() {
super.viewDidLoad()
// If my selected key is "Sunkist, what do i need to to get its value (0_22)"
// Any Code Help?
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}