In Xcode Debugger, how can I call a function inside of a function?
Code (errorMessage
is an instance method, and firstName
& lastName
are properties of self
.)
func errorMessage() -> String? {
func isValidName(name: String) -> Bool {
return 1...50 ~= name.characters.count
}
var nameType: String?
if !isValidName(firstName) {
nameType = "First"
} else if !isValidName(lastName) {
nameType = "Last"
}
if let messagePrefix = nameType {
return "\(messagePrefix) name must be between 1 & 50 characters."
} else {
return nil
}
}
Debugger (while stopped at the first if statement above)
(lldb) p isValidName("Matt")
error: <EXPR>:1:1: error: use of unresolved identifier 'isValidName'
isValidName("Matt")
^~~~~~~~~~~