Swift Error: Editor placeholder in source file
you had this
destination = Node(key: String?, neighbors: [Edge!], visited: Bool, lat: Double, long: Double)
which was place holder text above you need to insert some values
class Edge{
}
public class Node{
var key: String?
var neighbors: [Edge]
var visited: Bool = false
var lat: Double
var long: Double
init(key: String?, neighbors: [Edge], visited: Bool, lat: Double, long: Double) {
self.neighbors = [Edge]()
self.key = key
self.visited = visited
self.lat = lat
self.long = long
}
}
class Path {
var total: Int!
var destination: Node
var previous: Path!
init(){
destination = Node(key: "", neighbors: [], visited: true, lat: 12.2, long: 22.2)
}
}
How can I fix Editor placeholder in source file ?
Struct CircleView
has following initializer:
init(_ imageName: String) {
self.imageName = imageName
}
So, you have to provide imageName
of type String
while creating new CircleView struct.
CircleView("myImage")
You can always check for all available initializers and their parameter names after pointing carriage into the ()
and clicking Esc
button
Swift Editor Placeholder in source file
I found the same question many times on SO. But none of them gave the answer I was looking for.
You get the Placeholder in source file
when you have one of these (where it says "String" with a blue background) in your code.
A placeholder is for us programmers. It says "here should be a value of the type String". You can click on it and start typing, to simply replace it with for example a variable name. You can also press tab to automatically select the next placeholder. This is very useful when you are calling a function with multiple parameters (and therefore multiple placeholders).
A placeholder is actually just normal text (<#T##Strign#>), but XCode "translates" it to look like how it does.
In your case the error is on line three.
...withReuseIdentifier: "Cell", for: <#T##IndexPath#>) as! CustomBrandCell
As you can see <#T##IndexPath#>
is a placeholder as normal text as I mentioned earlier. You probably want this to be indexPath
Swift - 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).
Editor placeholder in source file swift
You need to write it like this:
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "MenuCollectionViewCell", for: indexPath) as! MenuCollectionViewCell
return cell
}
Related Topics
Google Plus API for Posting on Wall Like Facebook
Uicollectionview: Must Be Initialized with a Non-Nil Layout Parameter
iOS App Freezes on Pushviewcontroller
How to Change Color of Single Word in Uitextview and Uitextfield
Detecting Collisions in Sprite Kit
How to Know If Two Emojis Will Be Displayed as One Emoji
Retrieve Custom Prototype Cell Height from Storyboard
How to Achieve a "Clock Wipe"/ Radial Wipe Effect in iOS
iOS Background Audio Not Playing
How to Implement the Uitapgesturerecognizer into My Application
Combine Framework: How to Process Each Element of Array Asynchronously Before Proceeding
Does H.264 Encoded Video with Bt.709 Matrix Include Any Gamma Adjustment
Failed to Obtain a Cell from Its Datasource
Cannot Change Search Bar Background Color
Why Storyboard UI Elements Not Showing on Uiviewcontroller in Xcode 6
Restrict to Certain iOS Target Devices for App Store Submission
How to Find File Uti for File, Withouth Pathextension, in a Path in Swift