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
Get Cellid, Mcc, Mnc, Lac, Signal Strength, Quality and Network in iOS 8.3
Universal Links Not Working on iOS10
Apple MACh-O Linker (Id) Warning:Building for MACosx, But Linking Against Dylib Built for iOS
Accessibility for iOS, Voiceover Read Order Issue
Not Getting the Email Using Google Authentication in Firebase
Delete and Update Data in Core Data in iOS
Xcode 6.3: Could Not Load Nib in Bundle
Changes to Swiftui Fetchrequest Not Triggering View Refresh
Sending Latitude and Longitude to Server When App Is in Background
How to Control Avassetwriter to Write at the Correct Fps
Ios7 - Device Unique Identifier
Detect When a Unicode Character Cannot Be Displayed Correctly
Hit Detection When Drawing Lines in iOS
How to Update Data in Tableview Without the Delay Using Cloudkit When Creating New Records