I'm new to Xcode and trying to finish an assignment for a class in which I have 2 view controllers. I have no issues seeing my table view on the first view controller but unable to see the table view in the second view controller in the simulator.
I have the delegate and datasource outlets for the table view and an additional class in the 2nd view controller class to link the outlets for the custom cells.

The first view controller shows a list of albums. If adding or editing then there is a segue into a 2nd view controller which allows changes to the album and has a table view at the bottom in which tracks can be added or edited. I have no issue seeing the album details as you can see in the screenshot.
Here's my code for the 2nd view controller(AlbumDetailViewController):
class AlbumDetailViewController: UIViewController, UITableViewDelegate, UITableViewDataSource {
var tracks: [TrackObject] = []
var albumViewController: AlbumViewController!
var itemIndex = 0
var cell: TrackCell!
@IBOutlet weak var titleTextField: UITextField!
@IBOutlet weak var artistTextField: UITextField!
@IBOutlet weak var yearTextField: UITextField!
@IBOutlet weak var labelTextField: UITextField!
@IBOutlet weak var reviewTextField: UITextField!
@IBOutlet weak var trackListTableView: UITableView!
override func viewDidLoad() {
super.viewDidLoad()
}
override func viewWillAppear(_ animated: Bool) {
titleTextField.text = albumViewController.albums[itemIndex].title
artistTextField.text = albumViewController.albums[itemIndex].artist
yearTextField.text = albumViewController.albums[itemIndex].year
labelTextField.text = albumViewController.albums[itemIndex].label
reviewTextField.text = albumViewController.albums[itemIndex].review
}
@IBAction func savePressed(_ sender: UIButton) {
albumViewController.albums[itemIndex].title = titleTextField.text!
albumViewController.albums[itemIndex].artist = artistTextField.text!
albumViewController.albums[itemIndex].year = yearTextField.text!
albumViewController.albums[itemIndex].label = labelTextField.text!
albumViewController.albums[itemIndex].review = reviewTextField.text!
albumViewController.albumTableView.reloadData()
}
@IBAction func cancelPressed(_ sender: UIButton) {
if albumViewController.newFlag {
albumViewController.albums.remove(at: itemIndex)
albumViewController.albumTableView.reloadData()
albumViewController.newFlag = false
}
}
@IBAction func pressedEditTrack(_ sender: UIButton) {
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return tracks.count
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "trackListCell", for: indexPath) as! TrackCell
let track = tracks[indexPath.row]
cell.title?.text = track.title
cell.number?.text = track.number
cell.length?.text = track.length
return cell
}
}
class TrackCell: UITableViewCell {
@IBOutlet weak var title: UITextField?
@IBOutlet weak var number: UITextField?
@IBOutlet weak var length: UITextField?
}
I do also have 2 other classes that store the objects for Albums and Tracks. I have no trouble accessing their data, just seeing the table view and its cells.
I've tried and researched through other postings on SO but am able to find a solution for my issue. I have a feeling that I'm missing a component in my viewWillAppear method. I also have another version of this project in which I showed the track list in a 3rd view controller via another segue from view controller 2 but it has the same issue of not being able to see the table view. Appreciate any thoughts!