I need to do something like this (simplified for clarity):
protocol Initable {
init()
}
struct Foo : Initable {
var bar: String
init(bar: String = "Foobar") {
self.bar = bar
}
}
let foo = Foo()
but the compiler complains that Foo doesn't conform to the protocol, even though "let foo = Foo()" is perfectly valid code. In fact, I intend to call the function using the default parameters anyway... In my actual code there are several parameters with the defaults set to __FILE__, __FUNCTION__, __LINE__, and __COLUMN__ so that I can capture some metadata.
Anyone know a way to force the compiler to use a specific function for protocol conformance?