The completed ’Challenge’ app from Module 4 of the iOS Foundations course by CodeWithChris is a book preview app.
Naturally, I replaced the general book covers and text with my own (well, who wouldn’t?).
The app opens with a scrollable list of book covers, including title and author. The book clicks through to a cover preview and ratings screen.
This second screen has a ‘mark for later’ icon which changes from an open star to a filled star (and back, if tapped again). This star is shown on the main screen next to the title, if it’s been ‘activated’.
The ‘ratings’ element enables the user to select a rating between 1-5, and this rating remains persistent when the user taps away.
Tapping on this ‘preview’ brings up swipe-able screens containing text excerpts of the book.
The challenge was, indeed, a “challenge” that required a massive amount of what the iOS Foundation course has covered so far, plus some elements and modifiers that were new. I admit to using the challenge solution for some guidance and hand-holding, which exposed me to new things as well.
Several times during the challenge, I felt swamped by what felt unfamiliar and much that required delving back into previous lessons, and a certain amount of searching the internet. But there were also moments when I realised that there’s quite a lot of the ‘basic’ that I am starting to use as second-nature. If some stuff is second-nature now, then I can hopefully be assured that some of which seems overwhelming today will also become second-nature over the coming weeks.
Onwards and upwards!
Debug:
Due to changes since the lesson was created, swiping of the text causes the app to jump back when you swipe forwards, the following code needs to be added:
struct ContentView: View {
NavigationView {
...
}
.navigationViewStyle(.stack)
....
}
Another issue with the page not being displayed correctly was addressed on the CWC forum and requires the following code to be amended:
struct BookContent: View {
...
TabView(selection: $scene) {
...
}
...
.onAppear {
DispatchQueue.main.asyncAfter(deadline: .now() + 0.05) {
page = book.currentPage
}
}