Fix crash on search screen
This commit is contained in:
parent
31ee9cb027
commit
07f3d285d4
@ -14,8 +14,8 @@
|
|||||||
"kind" : "remoteSourceControl",
|
"kind" : "remoteSourceControl",
|
||||||
"location" : "https://github.com/xmartlabs/Eureka",
|
"location" : "https://github.com/xmartlabs/Eureka",
|
||||||
"state" : {
|
"state" : {
|
||||||
"revision" : "310bee0431ea2dcf43bb3154a8f1e0f44749aa12",
|
"revision" : "b6e35acf77a5551070afa6248935ec68e71f22af",
|
||||||
"version" : "5.3.5"
|
"version" : "5.4.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -50,8 +50,8 @@
|
|||||||
"kind" : "remoteSourceControl",
|
"kind" : "remoteSourceControl",
|
||||||
"location" : "https://github.com/realm/realm-cocoa",
|
"location" : "https://github.com/realm/realm-cocoa",
|
||||||
"state" : {
|
"state" : {
|
||||||
"revision" : "7ec5df0a700ef76ad930dcedb9c63c1b354979e1",
|
"revision" : "2dce752b48c3265c63ab04a8c66ddfdf9185f847",
|
||||||
"version" : "5.5.1"
|
"version" : "5.5.2"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@ -9,7 +9,7 @@ import AutoCatCore
|
|||||||
class SearchController: UIViewController, UISearchResultsUpdating, UITableViewDelegate, UIScrollViewDelegate {
|
class SearchController: UIViewController, UISearchResultsUpdating, UITableViewDelegate, UIScrollViewDelegate {
|
||||||
|
|
||||||
@IBOutlet weak var tableView: UITableView!
|
@IBOutlet weak var tableView: UITableView!
|
||||||
@IBOutlet weak var showMapButton: UIBarButtonItem!
|
@IBOutlet weak var showMapButton: UIBarButtonItem?
|
||||||
|
|
||||||
private var refreshButton: UIBarButtonItem!
|
private var refreshButton: UIBarButtonItem!
|
||||||
private var refreshIndicator: UIBarButtonItem!
|
private var refreshIndicator: UIBarButtonItem!
|
||||||
@ -28,7 +28,7 @@ class SearchController: UIViewController, UISearchResultsUpdating, UITableViewDe
|
|||||||
override func viewDidLoad() {
|
override func viewDidLoad() {
|
||||||
super.viewDidLoad()
|
super.viewDidLoad()
|
||||||
|
|
||||||
self.showMapButton.isEnabled = false
|
self.showMapButton?.isEnabled = false
|
||||||
|
|
||||||
searchController.searchResultsUpdater = self
|
searchController.searchResultsUpdater = self
|
||||||
searchController.obscuresBackgroundDuringPresentation = false
|
searchController.obscuresBackgroundDuringPresentation = false
|
||||||
@ -69,7 +69,7 @@ class SearchController: UIViewController, UISearchResultsUpdating, UITableViewDe
|
|||||||
.do(onNext: {
|
.do(onNext: {
|
||||||
if let count = $0.count {
|
if let count = $0.count {
|
||||||
self.navigationItem.title = String.localizedStringWithFormat(NSLocalizedString("vehicles found", comment: ""), count)
|
self.navigationItem.title = String.localizedStringWithFormat(NSLocalizedString("vehicles found", comment: ""), count)
|
||||||
self.showMapButton.isEnabled = count > 0
|
self.showMapButton?.isEnabled = count > 0
|
||||||
}
|
}
|
||||||
self.refreshControl.endRefreshing()
|
self.refreshControl.endRefreshing()
|
||||||
self.isLoadingPage = false
|
self.isLoadingPage = false
|
||||||
@ -161,7 +161,7 @@ class SearchController: UIViewController, UISearchResultsUpdating, UITableViewDe
|
|||||||
}
|
}
|
||||||
|
|
||||||
@objc func refresh(_ sender: AnyObject) {
|
@objc func refresh(_ sender: AnyObject) {
|
||||||
self.showMapButton.isEnabled = false
|
self.showMapButton?.isEnabled = false
|
||||||
self.datasource.reset()
|
self.datasource.reset()
|
||||||
self.filterRelay.accept(self.filter)
|
self.filterRelay.accept(self.filter)
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user