问题
I have a button to create an IBAction, and that button is Continue. However, when attaching the action I want to have a lower case continue. For some reason when I attach the action it is surrounded by single quotes. Why is this the case?
@IBAction func `continue`() {
//
}
回答1:
continue
is a swift keyword (along with many other programming languages) and as such cannot be used for variable's or action names without being wrapped in backtick quotes.
The compiler wraps it in backtick quotes as to not compute it as the keyword continue
Apple Doc
来源:https://stackoverflow.com/questions/35869902/single-quotes-around-ibaction