3

I'm not sure why, but for some reason I control-dragged a button as an Outlet to a view controller as usual, but the name was surrounded by Grave Accents ( ` ). Is there a reason for this? I haven't seen this notation before in Swift. What does it stand for?

My Outlets

@IBOutlet weak var q1: UITextField!
@IBOutlet weak var q2: UITextField!
@IBOutlet weak var q3: UITextField!
@IBOutlet weak var q4: UITextField!
@IBOutlet weak var q5: UITextField!

@IBOutlet var questions: [UITextField]!

@IBOutlet weak var `continue`: UIButton! 
Cole
  • 2,641
  • 1
  • 16
  • 34
  • "continue" is a Swift statement. I'm not sure about the implications of the accents to escape it, but I suggest picking another name (continueButton, maybe) to save yourself some difficulty. (A quick search got me more details: https://swift.unicorn.tv/articles/reserved-words-in-swift-and-how-to-escape-them) – Phillip Mills Aug 10 '15 at 01:04

1 Answers1

5

Because continue is a Swift reserved word. You can't use a reserved word as a variable name without surrounding it with backticks.

matt
  • 515,959
  • 87
  • 875
  • 1,141
  • Ah I see. I just looked it up in the Swift Documentation. Never used it before! Thanks! – Cole Aug 10 '15 at 01:10