Fix custom instances not showing up when typed into the instance

selector search field

With Combine Cancellables are automatically cancelled on deinit, so the
instance selector needs to hold on to a reference to pipeline
cancellable for its lifetime, otherwise it's cancelled immediately after
creation.

Closes #59
This commit is contained in:
Shadowfacts 2019-12-31 11:45:34 -05:00
parent 18c3c3c434
commit 6ef643e374
Signed by: shadowfacts
GPG Key ID: 94A5AB95422746E5
1 changed files with 2 additions and 1 deletions

View File

@ -26,6 +26,7 @@ class InstanceSelectorTableViewController: UITableViewController {
var recommendedInstances: [InstanceSelector.Instance] = []
let urlCheckerSubject = PassthroughSubject<String?, Never>()
var urlHandler: AnyCancellable?
var currentQuery: String?
init() {
@ -66,7 +67,7 @@ class InstanceSelectorTableViewController: UITableViewController {
navigationItem.searchController = searchController
definesPresentationContext = true
_ = urlCheckerSubject
urlHandler = urlCheckerSubject
.debounce(for: .seconds(1), scheduler: RunLoop.main)
.compactMap { $0?.trimmingCharacters(in: .whitespacesAndNewlines) }
.sink(receiveValue: updateSpecificInstance)