Last active
January 14, 2021 17:12
-
-
Save thepearl/ff849dab2d8e7798f2daf058f44fa749 to your computer and use it in GitHub Desktop.
ViewModel init
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
import Combine | |
class ViewModel | |
{ | |
var cancellables: Set<AnyCancellable> = [] | |
init() | |
{ | |
$keyWordSearch | |
.receive(on: RunLoop.main) | |
.debounce(for: .seconds(0.5), scheduler: RunLoop.main) | |
.sink { (_) in | |
self.fetchMovies() | |
}.store(in: &cancellables) | |
} | |
@Published var keyWordSearch: String = "" | |
var diffableDataSource: MoviesTableViewDiffableDataSource! | |
var snapshot = NSDiffableDataSourceSnapshot<String?, Result>() | |
func fetchMovies() | |
{ | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment