Cinema Trivia 2 V1.1 Behind the Scene

One of the most interesting things I did in version 1.1 code wise was breaking up a large SwiftUI view into multiple smaller SwiftUI views. The challenge I ran into right away was figure out a way to execute methods of the main view from its sub-view in SwiftUI. For example: a sub-view that contains a button that affects the main view. I was used to OO development but SwiftUI views are not classes. After some research, the solution turned to be something I already knew but not used much in my work until now – assigning functions to variables. I was able to pass methods from one view to another and run them like closures. The rest was pretty straight forward.

The large SwiftUI view mentioned above also had many state variables. These state variables were moved into separate structs in version 1.1 which cleaned up the view source code even more.

Apple introduced recurring leaderboards in iOS 14, and I adopted it in version 1.1. Even though I had both daily and weekly leaderboards in version 1.0, they were not truly recurring in nature. They were more like top scores in last 24 hours (daily) and last 7 days (weekly). The new leaderboards had a configurable reset that made them truly recurring. Because the API for the new leaderboards is different from the old leaderboards and I could not make the new API work in iOS 13, iOS 13 users will still use the old leaderboards while iOS 14 users will use the new leaderboards.

Three new categories of questions were added in version 1.1 which brought the total to 15. The quality of questions and answers for one or more categories was improved. Back-to-back questions from the same category was eliminated. Some of the changes involved altering SQLite database schema. New movies and related data were added to the database as well.

This type of changes is basically on-going for the lifetime of this app: new categories, quality of questions and answers, fresh contents, and new game modes.

I have some ideas for version 1.2 but also want to port this app to Android. I also want to start working on another iOS app of different type. This should be interesting.