LukoM LukoM - 6 months ago 419
Swift Question

Swift - Editor placeholder in source file

I am new to swift and I was following an open source tutorial to learn Swift, however one error keeps cropping up - "Editor placeholder in source code" This is the code:

func setupGameLogic (){
for index in 0 ... fields.count - 1{
let gestureRecogniser = UITapGestureRecognizer(target: self, action: Selector("fieldTapped:"))
gestureRecogniser.numberOfTapsRequired = 1

fields[index].addGestureRecognizer(gestureRecognizer: UIGestureRecognizer) //Editor placeholder in source file
}
}

Answer

This code is wrong:

fields[index].addGestureRecognizer(gestureRecognizer:  UIGestureRecognizer)

When you are calling a method, you supply an argument value: you do not supply a type describing the required parameters. You want to say this:

fields[index].addGestureRecognizer(gestureRecognizer)

An editor placeholder is a solid rounded rectangle with text in it, inserted through code completion. It might look like this:

enter image description here

or this:

enter image description here

You need to look for that sort of thing in your code and replace it with actual text (or delete it).

Comments