iOS App Reflection (Milestone 4)
Posted by jpmyers97 in Mobile App Development on October 17, 2019
Project 1: Complete
This project was surprisingly inspirational and enjoyable to develop. I started out with a solid concept of a fortune cookie generator. While somewhat simple in nature, it definitely tested my capabilities within Xcode and Swift as an app developer. From a creative standpoint, I sought to make a visually appealing and intuitive interface. At first I felt compelled to creative multiple tabs with informational text and even a help button, but for the scope of my idea these were eventually deemed unnecessary additions to the app. The final version ended up only needing three buttons: the fortune cookie button itself, a share button, and one more to toggle user preferences.
The code for this app was relatively simple to implement. With only one view to worry about, my biggest issue was finding a way to store all of the fortune data. The Fortune class itself is quite minimal, with only a two variables to track a fortune’s text and type. All fortunes are created from a two dimensional array containing a list of fortunes and their respective types and loaded into an array of type Fortune, which contains all of the fortunes themselves.
The user preferences for my app are handled by a single picker view. The categories are loaded from an array containing all the fortune types (which at this time consists of “All”, “Finances”, “Health”, “Relationships”, “Wisdom”). This picker view sets the preferred type variable within the view controller class, which gets checked whenever a fortune gets generated.
Fortunes are loaded by generating a random index value and selecting a fortune from the fortunes array. If necessary, it will continue to randomly pick fortunes until the type matches whatever was selected in the user preferences. This fortune then gets displayed in a label’s text field and another random number between 1 and 64 is generated as that fortune’s “Lucky Number”.
I also incorporated a share feature using the UIActivityView class. This allows data to be sent out to numerous applications such as text messenger, photos, safari, etc. In my case, I used this to send text (the fortune and lucky number) to others via the messenger app. For the scope of my project, I’m very satisfied with how this turned out. In the future, I have the option to add even more fortunes and types, as well as additional features like finding local Chinese restaurants or offering a full description of a more detailed fortune (similar to a horoscope reading).