class Wesley: Developer {
let name = "Wesley de Groot"
let age = 34
let location: Location = .Netherlands
let languages: [Languages] = [.Dutch, .English]
let programmingLanguages = ["Swift", "Objective-C", "JavaScript", "PHP"]
let markup = ["HTML", "CSS"]
func details() -> String {
var details = ""
for detail in Mirror(reflecting: self).children {
guard let label = detail.label else { continue }
details.append("\(label.capitalized): \(detail.value)\n")
}
return details
}
}
print(Wesley().details())
// The above doesn't compile?
// Just add this "missing" code.class Developer {
enum Location { case Netherlands }
enum Languages { case Dutch, English }
}
OTP Code Generation with CryptoKit: A Swift Approach
My projects have 231 ⭐️, and 35 Forks.
Interested learning more about Swift? Check out my blog.