Channel List
// This is the data backing the TableView
var channels = [ParticipatedChannel]()
override func viewDidLoad() {
super.viewDidLoad()
// Get the AppDelegate which contains the Mitter object
let appDelegate = UIApplication.shared.delegate as! AppDelegate
// TableView setup
...
// Fetch the list of channels and display
appDelegate.mitter.channels.getChannelsForCurrentUser {
result in
switch result {
case .success(let fetchedChannels):
self.channels = fetchedChannels
print("Received all channels for logged in user")
self.tableView.reloadData()
case .error:
print("Couldn't fetch all channels for logged in user")
}
}
}Last updated