iOS: Make more use of native Swift types

This commit is contained in:
Jonathan Schleifer 2019-06-20 01:15:26 +02:00
parent 0886af554c
commit 773af9361e
No known key found for this signature in database
GPG key ID: 79D21189A2D4708D
4 changed files with 61 additions and 87 deletions

View file

@ -25,7 +25,7 @@ import ObjFW
class MainViewController: UIViewController, UISearchBarDelegate,
UITableViewDelegate, UITableViewDataSource {
public var sites = OFArray<OFString>()
public var sites: [String] = []
public var siteStorage = SiteStorage()
@IBOutlet var searchBar: UISearchBar?
@IBOutlet var tableView: UITableView?
@ -51,12 +51,12 @@ class MainViewController: UIViewController, UISearchBarDelegate,
cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "site") ??
UITableViewCell(style: .default, reuseIdentifier: "site")
cell.textLabel?.text = sites[indexPath.row].nsObject
cell.textLabel?.text = sites[indexPath.row]
return cell
}
func searchBar(_ searchBar: UISearchBar, textDidChange searchText: String) {
sites = siteStorage.sites(withFilter: searchBar.text?.ofObject)
sites = siteStorage.sites(withFilter: searchBar.text)
tableView?.reloadData()
}