I have two ViewControllers. First is the MoviesVC which shows the lists of movies. The second is the BookmarkedVC which shows the movies which was bookmarked by user.
I have movies:[Movie] property in MoviesVC. Movie class has a bookmark = false flag to determine whether movie is bookmarked or not. When user click bookmark button on cell, I update flag to true.
Since BookmarkedVC is also showing the lists of bookmarked movie, I inherit BookmarkVC: MoviesVC.
In BookmarkedVC viewWillAppear() method, I fetch the bookmarked movies by calling the function below
func loadBookmarkedMovie() -> [Movie] {
let bookmarkedMovies = self.movies.filter { return $0.bookmark == true }
return bookmarkedMovies
}
The problem is bookmark of self.movies is still false although they were bookmarked.
To make sure, I call loadBookmarkedMovie() in MoviesVC after I had bookmarked some movies and it actually return the bookmarked movies but in BookmarkedVC it return nil