Hi everyone! Here I have a new problem: My application compiles but unfortunately, I can't open the files contained in the json file. My indexViewController file doesn't display it.
Here is the link of my json file: https://drive.google.com/file/d/1qMKLNcf1fvYla21Yhh_D36FuPI-0-kj2/view?usp=drivesdk
and my Index file : https://drive.google.com/file/d/169H5w6WvqAE43B4VceXqvSrHJXJUzE8Y/view?usp=sharing
and here is the code of my indexviewcontroller :
@IBOutlet weak var indexTableView: UITableView!
@IBOutlet weak var bookmarkButton: UIBarButtonItem!
// The BookViewModel init method decodes the json file and sets the chapters property on this instance
var book: BookViewModel = BookViewModel()
var chapters: [ChapterViewModel] = [ChapterViewModel]()
var managedObjectContext: NSManagedObjectContext!
var hasUserTappedOnBookmarkWidget: Bool = false
let searchController = UISearchController(searchResultsController: nil)
var filteredChapters: [ChapterViewModel] = [ChapterViewModel]()
var chapNumberAndSearchTextRangeList: [Int: [ChapterViewModel]] = [Int: [ChapterViewModel]]()
var searching = false
lazy var workItem = WorkItem()
private var userClickedChapter: ChapterViewModel?
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
chapters = book.chapters
setNavBarLargeTitleProperty()
// This makes the table view row animate its selection state as it pops and pushes on the navigation stack.
if let selectedIndex = indexTableView.indexPathForSelectedRow {
let coordinator = self.transitionCoordinator
if coordinator != nil {
coordinator?.animate(alongsideTransition: { (context) in
self.indexTableView.deselectRow(at: selectedIndex, animated: true)
}, completion: { (context) in
if context.isCancelled {
self.indexTableView.selectRow(at: selectedIndex, animated: false, scrollPosition: .none)
} else {
self.indexTableView.deselectRow(at: selectedIndex, animated: true)
}
})
} else {
self.indexTableView.deselectRow(at: selectedIndex, animated: true)
}
}
// if the user has tapped on the widget, navigate to BookmarkViewController directly
if hasUserTappedOnBookmarkWidget {
performSegue(withIdentifier: "goToBookmarks", sender: self)
}
}
override func viewDidLoad() {
super.viewDidLoad()
// Set the datasource and delegate as self
indexTableView.dataSource = self
indexTableView.delegate = self
indexTableView.register(UINib(nibName: "IndexCell", bundle: nil), forCellReuseIdentifier: "customIndexCell")