简体   繁体   中英

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
    }
}

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:

在此处输入图片说明

or this:

在此处输入图片说明

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

程式码片段

For example, if you left the blue place holder code in the file when you ran your program, it will give you this error. Try to delete it, then go to Product->Clean and Product->Build.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM