问题
I was checking out the Swift documentation on implicit returns. Consider this function from the docs:
func greeting(for person: String) -> String {
"Hello, " + person + "!"
}
When I copy and paste it into xCode I get an error: "Missing return in a function expected to return 'String' "
My swift version is set to 5.0 in build settings.
Honestly don't know if I am missing something obvious here, or if there is a problem with my other xCode build settings? Ideas?
来源:https://stackoverflow.com/questions/56812483/swift-implicit-return-not-compiling