프로퍼티를 초기화하는 두 가지 방법이 무슨 차이가 있는지 궁금해서 찾아봤다
struct Fahrenheit {
var temperature: Double
init() {
temperature = 32.0
}
}
struct Fahrenheit {
var temperature = 32.0
}
If a property always takes the same initial value, provide a default value rather than setting a value within an initializer. The end result is the same, but the default value ties the property’s initialization more closely to its declaration. It makes for shorter, clearer initializers and enables you to infer the type of the property from its default value. The default value also makes it easier for you to take advantage of default initializers and initializer inheritance, as described later in this chapter.
자세한 내용은 공식 문서에 더 있다
https://docs.swift.org/swift-book/LanguageGuide/Initialization.html