switchToLatest so that the delayed trending code doesn't override the search

This commit is contained in:
Zhigang Fang
2016-06-18 23:38:58 +08:00
parent 6e6fe937a2
commit d96fc4dfeb
2 changed files with 7 additions and 1 deletions

View File

@@ -32,7 +32,8 @@ class HomeViewModel {
.switchLatest()
isSearching.asObservable()
.flatMap({ $0 ? searching : trending })
.map({ $0 ? searching : trending })
.switchLatest()
.subscribeNext({[unowned self] in
self.giphys.value = $0
})

View File

@@ -31,6 +31,11 @@ class GiphySearchUITests: XCTestCase {
func testExample() {
// Use recording to get started writing UI tests.
// Use XCTAssert and related functions to verify your tests produce the correct results.
let app = XCUIApplication()
app.searchFields["Search"].tap()
app.typeText("hello\r")
app.buttons["Cancel"].tap()
}
}