What would be a good practice for object initialization in swift from given below? And why?
1. Initialize while declaring
class MyClass {
var object: MyObject = MyObject()
}
2. Initialize in init()
class MyClass {
var object: MyObject
init() {
object = MyObject()
}
}
If there are any other approaches then feel free to give suggestions.