12 Weeks as a iOS Developer Intern — Week Two

Lisa Jiang
Fuzz
Published in
3 min readJul 8, 2018

One quote that has stuck with me from the previous iOS director was to always strive for excellence. I woke up everyday this week thinking about this on the way to work.

This week I got to work on a some screens and bug fixes for a project. Here are some of things I learned during week two:

  1. Consistent constraint insets/offsets — when using consistent constraint insets and offsets, it is best to have them in a struct so there aren’t random numbers littered in your constraints.

If the inset/offset needs to be changed 1pt, this can be changed via the struct in 1 place as opposed to many places if the margin was not stored elsewhere.

2. When you have intuition on a simplistic approach in building a feature that should work but can’t figure it out so try some outlandish complicated approach, you were probably right about the initial simplistic approach.

Example:

I was getting data that had an enum type with associated values of either “asap” or the type of Date, both associated values. I had to get the Date out of the data but I couldn’t for the life of me figure it out. The usual way you access an enum without associated values is by (.dotNotation). This didn’t work for me because this is not how you access an enum’s associated values(hold on to this thought). Which led to me trying some complicated finagling approach of turning the data into a string which resulted in:

  • string of “date("2018–07–07 11:00:00 +0000”)”
  • then using string manipulation methods of .dropFirst() and .dropLast() to remove the “date()” portion which finally resulted in
  • string of “2018–07–07 11:00:00 +0000”
  • but then for some reason I tried using Date method to turn this string to a date which would not work…..

This was when I finally asked my manager for help. He confirmed that my initial intuition was correct that I should be accessing the date through the data enum’s associated value! ;-;

tldr: When there’s 2 approaches:

  • a simple one that should work but you can’t figure it out or
  • a long complicated finagle approach, this is probably when you should get help because this is how developers time is wasted. I could have saved quite a bit of time if I had just asked this question which would’ve taken a minute to put me on the right track. Lesson learned!

Anyways this is how to access an enum’s associated value:

  • by switching on the enum
  • access associated values via case

3. How to get fully spelled out Month and ordinal date of the month from a Date()

eg: Date(2018–07–07 11:00:00 +0000) — > July 7th, 2018

There’s no method I know of that Apple provides to give you spelled out Months and ordinal dates. So this is how I did it:

What did you learn this week?

--

--

Lisa Jiang
Fuzz
Writer for

Software Engineer @LinkedIn| Prev: SWE Apprentice @Linkedin, Jr. iOS Dev @Fuzz, @C4Q alum | I write about my coding journey, in hopes of helping you on yours