I guess, based on the code you posted, that you are trying to “forward-declare” your init and bar methods.
There are no forward declarations in Swift.
Because Foo is a class, it can have two kinds of init: “designated” and “convenience”. All designated inits need to be defined in the main body of Foo, and you must have at least one designated init. You can put convenience inits and other methods in extensions. For example:
class Foo {
var x: Int
// Note that this is a designated init because it doesn't have the
// `convenience` keyword.
init() {
x = 0
}
}
extension Foo {
convenience init(v: Int) {
self.init()
x = v
}
}
extension Foo {
func bar() -> Int {
return x
}
func bar(u:Int, v:Int) -> Int {
return x + u + v
}
}
That seems like a job for the text editor/IDE level. It's also duplicating information, so you have to jump back and forth to keep it all in sync. Why waste human effort to generate interfaces for presentation like this, when a machine can prepare it automatically?
Ironically, the split header+implementation structure of C/C++ programs is often cited as one of the biggest factors that make them feel "old".