Editor placeholder in source file Xcode 8

Hi everyone. I'm new to using Xcode and this is my first time coding. I'm currently following some tutorials that require this coding to create a rectangle:


let canvas = UIView(frame: CGRectMake(0, 0, 200, 200)). I know that CGRectMake was removed from xcode so I changed my code to


let canvas = UIView(frame: CGRect(x: 0, y: 0, width: 200, height: 200))


I'm getting a swift compiler warning of 'editor placeholder in source file'. Can someone tell me how to fix this and why i'm getting it?

Answered by QuinceyMorris in 237482022

When you insert code via autocompletion (or via a code snippet, sometimes), there may be placeholders — blue rectangles that describe what you should put there instead. You can click on a placeholder to select it, then type your actual code.


For example (I'm guessing) when you typed "UIView(", you inserted a complete call, but with a "CGRect" placeholder where the rect was supposed to go. If you put the rect parameters after the placeholder without replacing it, you'd get this error message. You should have replaced the placeholder, not used it as code.


If that's what happened, you don't have to actually retype it in this case. If you double-click on a placeholder (or select it and press Enter), it will change to regular text.

Accepted Answer

When you insert code via autocompletion (or via a code snippet, sometimes), there may be placeholders — blue rectangles that describe what you should put there instead. You can click on a placeholder to select it, then type your actual code.


For example (I'm guessing) when you typed "UIView(", you inserted a complete call, but with a "CGRect" placeholder where the rect was supposed to go. If you put the rect parameters after the placeholder without replacing it, you'd get this error message. You should have replaced the placeholder, not used it as code.


If that's what happened, you don't have to actually retype it in this case. If you double-click on a placeholder (or select it and press Enter), it will change to regular text.

11

That's exactly what I did by the looks of it. I've double-clicked and its changed and given me the rectangle I needed. Thanks!

Command + Shift + b
It works perfectly... I have already done this for tableView
In addition to the solution offered by Quincey Morris, if you can't find said placeholder, try closing and reopening your project, or even Xcode.

Thank you @Anam098 it worked.
Editor placeholder in source file Xcode 8
 
 
Q