What’s My Star Sign — First iOS app
I want to learn how to code iOS apps so that I can have a better appreciation for the work that is involved in building products. As a result, I have started following online tutorials for Swift and want to share my progress.
Before I delve into my app, I have learnt the following concepts in Swift.
- Building a User Interface (how things are displayed on the screen)
- Coding basics
- Passing data between Screens
- Interacting with Git (version control)
I wanted to take a break from watching tutorials and test my knowledge by creating my first app.
What’s My Star Sign
App summary:
- User types in their name and date of birth
- User’s star sign is returned to them
Here is the business logic that determines which star sign a user is.
The Switch statement takes in the user’s DOB and checks one case at a time if it falls within the date range of a specific star sign. It was a trial and error process and lots of bug fixing before deciding on the logic above which used Tuples . A Tuple is a comma-separated list of types enclosed in parenthesis e.g.
Capricorn — (December 22-January 19) would be (22…31, 12) (01…19, 01).
This means the users birthday has to be in the range of the 22nd to 31st December (12th month) or the 1st to the 19th January (1st month).
What did I learn?
- Interface Builder (Displaying elements on a screen)is finicky.
- Be logical and patient when fixing bugs. Using pen and paper helps!
- Online tutorials can give me a false sense of security. I made more mistakes, learnt more and was rewarded more by exploring.
The biggest obstacle to writing this post was worrying what others would think of my code. I hope by sharing my code I can encourage others who might feel the same way. Let me know what you think.
https://github.com/aaronjohal/star-signs
I would like to thank Mark Price of Devslopes for the tutorials that have enabled me to build my first app.