참고 블로그 : https://bicycleforthemind.tistory.com/26
enum helloWorld {
case hello
case world
var message: String {
switch self {
case .hello:
return "hello"
case .world:
return "world"
}
}
}
print(helloWorld.hello.message) // "hello"
enum helloWorld {
static let hello = "hello"
static let world = "world"
}
print(helloWorld.hello) // "hello"
struct helloWorld {
static let hello = "hello"
static let world = "world"
}
let hello = helloWorld()
print(hello.hello) // "hello"
struct helloWorld {
static let hello = "hello"
static let world = "world"
private init() {}
}
let hello = helloWorld()
// 'helloWorld' initializer is inaccessible due to 'private' protection level