MakeSchool-Tutorials / Makestagram-Swift-V3

14 stars 7 forks source link

10. Refactoring Stringly Typed Code #72

Closed byzantinist closed 7 years ago

byzantinist commented 7 years ago

Grammar

We refactored the method for creating an user to our UserService but we haven't refactored our LoginViewController to remove all networking logic as well.

should be

We refactored the method for creating a user to our UserService but we haven't refactored our LoginViewController to remove all networking logic as well.


We'll store our string identifiers as static constants so we can reuse throughout the app without worrying about misspelling them.

should be

We'll store our string identifiers as static constants so we can reuse them throughout the app without worrying about misspelling them.


the compiler will throw a error if we misspell an identifier

should be

the compiler will throw an error if we misspell an identifier


Let's take look at the second way of handling stringly-typed code: enums!

should be

Let's take a look at the second way of handling stringly-typed code: enums!


Inside our new Storyboard.Utility.swift file, extend UIStoryboard with the following enum:

should be

Inside our new Storyboard+Utility.swift file, extend UIStoryboard with the following enum:


It'll allow use initialize the correct storyboard based each enum case.

Bad grammar.

ocwang commented 7 years ago

Fixed!