Closed a-voronov closed 8 years ago
Looks good to me. Thanks! 👍
I'll look into the optional init myself. If there is no information from the SourceKitten output, we'll have to do forward peek in the source itself. We already do this for throws
and rethrows
because these are not mentioned in the SourceKitten output as well.
I've tried this and it is a step forward, but not yet a solution. We need a better one, because we have our own initializers in the mock class and we need to figure out how to call super initializers properly. That might be a PITA.
We won't be really able to mock initializers AFAIK. We need to parse designated initializers from the super class, override them and ask users for the parameters and pass them into the super init. Also the mock class should be final so we don't have to care about required
keyword.
I actually thought of declaring
isInitializer
likeBut this is kind of different issue. Failable initializer looses question mark when generated as a class method name. So this code
init?(a: Int) { return nil }
will result withtoken.name
like thisinit(a:)
Not yet sure if this is an issue though.