Compile time errors are good 🚀 — part 1

let user = User()
var firstName: String!

1. default values

2. dependency injection

let user = User()
let user = User(firstName: "Ritesh", lastName: "Gupta")
  • let makes property immutable, once initialised you can’t update its value later.
  • var makes property mutable, you can update its value as you like, whenever you like.

--

--

--

iOS Developer

Love podcasts or audiobooks? Learn on the go with our new app.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Ritesh Gupta

Ritesh Gupta

iOS Developer

More from Medium

App Tracking Transparency in iOS 15

How to monitor progress of Xcode installation from App Store

RxSwift Combination Operators: zip, combineLatest & withLatestFrom

MVVM-C Xcode Template to reduce development time