ex.
self.performSegue(withIdentifier: "RegisterToChat", sender: self)
self.performSegue(withIdentifier: "LoginToChat", sender: self)
→ "RegisterToChat" & "LoginToChat" are all programmer-written Strings that are extremely vulnerable to typos. One small typo can lead the app to crash.
→ Hence we need to reduce the number of times we write these Strings in some way.
→ We want to make sure we are accessing these types of Strings using code, instead of typing it every time we need it. Imagine having to Write "PerformSegueToRegisterToChat" every single time you need it somewhere in your code.
Thats why we needs a Constants File
→ Notice we made the constants as "static". This is turning it to an instance property to a type property.
ex. Accessing the static constant
Constants.registerSegue
→ We don't have to make an instance of the Constants struct such as below:
let myConstants = Constants()
// Not necessary to access static constants
This is becuase registerSegue and loginSegue are now a type property, instead of an instance property.