I am learning swift and want to understand how to make nested functions
extension Auto {
// MARK: Auto extensions
func isRegistred() -> Bool {
return true
}
}
if I want to verify if an Auto is registered I have to use this line
if Auto.isRegistered()
If the auto is registered I also want to be able to verify if it's a new one, so I want to add a isNew() function. Is it possible to add a nested function so that I can still verify if the auto is registered with Auto.isRegistered() and use Auto.isRegistered().isNew() to verify that it's a registered auto and a new one? Something like
extension Auto {
// MARK: Auto extensions
func isRegistred() -> Bool {
func isNew() -> Bool{
return true
}
return true
}
}