TableView de recherche en Swift

J'ai deux tableaux: FirstTableArray (inclure le nom de marques) et SecondTableArray (inclure les modèles).

Je veux ajouter de la recherche par le biais de laquelle le modèle de téléphone peuvent être trouvés par une partie du nom.

import UIKit
import MessageUI
class FirstTableViewController: UITableViewController {
var FirstTableArray = [String]()
var SecondTableArray = [SecondTable]()
override func viewDidLoad() {
super.viewDidLoad()
self.navigationController?.navigationBar.isTranslucent = false
self.navigationController?.navigationBar.barStyle = .black
self.navigationController?.navigationBar.tintColor = UIColor.white
//First Table Array

FirstTableArray = ["Apple", "Samsung"]
//Second Table Array

SecondTableArray = [
SecondTable(SecondTitle: ["iPhone 5s", "iPhone 6", "iPhone 6s"]),
SecondTable(SecondTitle: ["Galaxy S4", "Galaxy S5", "Galaxy S6"]), 
]   
}
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int
{
return FirstTableArray.count
}
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let Cell = self.tableView.dequeueReusableCell(withIdentifier: "Cell", for: indexPath) as UITableViewCell
Cell.textLabel?.text = FirstTableArray[(indexPath as NSIndexPath).row]
return Cell
}
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
let indexPath : IndexPath = self.tableView.indexPathForSelectedRow!
let DestViewController = segue.destination as! SecondTableViewController
let SecondTableArrayTwo = SecondTableArray[(indexPath as NSIndexPath).row]
DestViewController.SecondTableArray = SecondTableArrayTwo.SecondTitle
} 
}

Pouvez-vous m'aider?

OriginalL'auteur user6023982 | 2017-01-15