Posts

Post marked as solved
8 Replies
Many Thanks! Your help has been truly Appreciated!
Post marked as solved
8 Replies
So I added the prints, I also added one tofunc tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { return 1 }The total output into log is as follows:addToLibrary(_:) is calledloadDataSource() nil nil nil niltableView(_:numberOfRowsInSection:) 1tableView(_:numberOfRowsInSection:) 1tableView(_:cellForRowAt:) indexPath [0, 0]Doesnt seem to be any output for:print(#function, "I prepare for segue with", movieTitle, movieReleaseDate)Does this mean that there is an error with my prepare statement if values at loadDataSource() are nil?
Post marked as solved
8 Replies
I connected the segue as you stated above, view controller to view controller, giving it the identifier "LibViewSegue"after following your instruction to instrument, the following was output in Log: addToLibrary(_:) is calledIf this means that the prepare is called, how can it be that the variables at the destination view controller return nil?
Post marked as solved
8 Replies
Many Thanks for your reply,I have added the print statements you outlined above to the code, however the first;print(#function, "I prepare for segue with", movieTitle, movieReleaseDate)Seems to return no data to the log.the second two statements both returntableView(_:cellForRowAt:) indexPath [0, 0]tableView(_:cellForRowAt:) libMovie libMovie(title: " nil", release: " nil")I had added a few print("movieTitle") statements throughout the code and it does seem that the values for both movieTitle and movieReleaseDate are populated with data before the prepare statement, but then become 'nil' after the prepare for segue functionas for the the button action, it is simply as follows@IBActionfunc addToLibrary(_ sender: Any) { self.performSegue(withIdentifier: "LibViewSegue", sender: self) }I am unsure if i require more code in the button action for the prepare statement to be called, or if i need the prepare statement to be within the button action (which seems to have no effect on the code)
Post not yet marked as solved
6 Replies
"As said before, you have to send data to the ViewController. Not to the cell directly."I'm not sure I follow, are you saying that i should remove the prepare function in TableViewCell and instead directly send it from MovieDetailVc to LibraryViewController? var libraryMovies: [NSDictionary] = [] is useless and was used in experimentation to see what fitsI do however have a var newMovies: [NSDictionary] = []on the first table view to declare the movie details used on the first view and MovieDetailVC, is it possible to reference it in a third view controller?"What do you expect by declaring a constant for libraryTitle" -> I assumed we had to cretae a property in the destination to hold the value to pass, like in your first comment
Post not yet marked as solved
6 Replies
Thanks for your reply, I have updated and added as much relevant code in the project as possible,In the TableViewCellI receive an error on the following line: " Instance member 'libraryTitle' cannot be used on type 'LibraryMovieViewController' " LibraryMovieViewController.libraryTitle = movieTitle