Hello blog viewers,
I have just completed the fourth week of my SRP. During this week, I focused on programming the core data of the app. The core data of the app is where I will be storing all of the answers to the stress related questions from any stress incident. These answers will be stored, converted to numbers, and displayed in the form of graphs. The core data will store data in a “persistent store”. In other words, if the app is terminated completely and the user restarts his/her mobile device multiple times, the app will retain this information. Each stress incident will capture series of stress related data and the app will compile this data and present it in a graphical user interface. Since the app revolves around retaining stress data from each stress incident, this is the key part of the app. As you may imagine, such a key sub-system requires a lot of careful design and coding. I have never worked with core data before so I have been learning about it and have not gotten to code as much as I would have liked. I found the tutorials on www.raywenderlich.com to be particularly helpful for any of you other Swift coders out there. There is a lot more coding to be done for the core data of the app which I plan to work on next week.
I also worked on passing variables and constants between view controllers. Each view controller can have its own individual variables and constants (which the programmer codes). However, these variables and constants are not globally shared between all of the view controllers. There are exceptions to this when you only need one instance of an object to live during the lifecycle of an app. These objects are often called “singleton” objects, as you can imagine from the name, a single instance of the object exist during the lifecycle of the application. I have been programming the app so that each view controller passes any necessary variables to the next view controller.
After coding for awhile, I set out to test whether my code worked. I created a label in a view controller after the stress rating (from 1 to 5) question (in a previous view controller). I set up the label so that it would show the number that the user selected (on the previous view controller) on how stressed they felt. After programming this into the app, I tested it out.
I ran the test build and went to the stress rating question. I selected a random number (four in this case) and hit the “Next Question” button, fingers crossed.
Hooray! As you can see, the label (in green text) is showing four, the number I selected in the previous view controller. This may not seem like much, but passing variables and constants between view controllers was a week long struggle for me where I came across countless errors which I had never faced before. Finally conquering this vital piece of code was a huge relief.
As a side note, I also added a pop up alert which comes up whenever the user taps on the “Finish” button after completing the stress incident survey. Here’s a picture of it:
This next week, I plan on continuing learning and coding the core data for the app (and hope to make significant progress). The coding is getting more advanced and intense every day! As I’m developing this app, many new ideas for the app arise to the point that I have started keeping a list of different ideas and adopting the feasible ones and hope to incorporate some of the more advanced ideas for future releases.
I hope to see you all in my next blog post!
Congrats on the progress. The app is looking really good so far!
ReplyDeleteGood! What do you think your GUI will look like when it's completed?
ReplyDeleteLooks great! How many questions do you plan on the app asking?
ReplyDelete