Created
October 25, 2018 13:45
-
-
Save marinat/593efde07475b9a071f86448f51d5c4e to your computer and use it in GitHub Desktop.
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
songsService.callApiGetArtists(onSuccess: { (response) in | |
self.artists = response.getArtists() | |
self.tableView.reloadData() | |
}) { (error) in | |
self.handleError(error: error) | |
} | |
//=-------------------------- | |
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { | |
if (artistButton.isActive) { | |
return artists.count | |
} else { | |
return songs.count | |
} | |
} | |
//--------------- | |
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { | |
if (artistButton.isActive) { | |
let cell = tableView.dequeueReusableCell(withIdentifier: "ArtistCell")! | |
cell.textLabel?.text = presenter.searchArtists[indexPath.row].name | |
return cell | |
} else { | |
return createSongCell(song: presenter.songs[indexPath.row], lastRow: indexPath.row == songs.count-1) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment