Adding the search function

The second step is to add the logic to do the searches properly. Let's create the package co.starcarr.rssreader.search and place the file Searcher.kt inside it:

Now we will create the class Searcher inside it, and include a function that will return a ReceiveChannel<Article>, given a query. Notice that we want to return a ReceiveChannel so that the caller doesn't use this channel to send information:

class Searcher() {
fun search(query: String) : ReceiveChannel<Article> {
val channel = Channel<Article>(150)
return channel
}
}
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.189.189.67