Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
398 views
in Technique[技术] by (71.8m points)

ios - Swift Error: Editor placeholder in source file

Hello I am implementing a graph data structure. When I try to build the application the I get the error "Editor placeholder in source file"

The full graph implementation was pulled from WayneBishop's GitHub from here https://github.com/waynewbishop/SwiftStructures

class Path {

var total: Int!
var destination: Node
var previous: Path!

init(){
    //Error happens on next line
    destination = Node(key: String?, neighbors: [Edge!], visited: Bool, lat: Double, long: Double)
     }
}

I changed the Node Class around to:

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!]()
     }

}

This Error happens 5 times throughout the code that I have built so far. Also this question has been asked, but not answered.

I think the error may be due to my changes to the init() in the Node class. Prior to my changes it was just init(). If it is, how can I add objects to the class? Pardon me if I am not correct in my programming terminology, as I am relatively new to OOP.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Sometimes, XCode does not forget the line which had an "Editor Placeholder" even if you have replaced it with a value. Cut the portion of the code where XCode is complaining and paste the code back to the same place to make the error message go away. This worked for me.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...