This is a rather strange mistake.
This happens when you try to pass enum to the initializer argument, autocomplete will fail and instead of suggesting enum cases after entering Enum. , it will list the members of the class instance that you are calling the initializer on. If you try to use the single-point syntax ( .Case ), autocompletion will also fail, but instead of displaying a list of instance members, it just won't display anything.
Initially, I thought that this could have something to do with the name of your enum and class ( BuildingType and Building ), but that is not the case.
This error is present only in initializers with several arguments (one of which is an enumeration). I could not reproduce this problem with single argument initializers.
Reproducibility seems to depend on whether the initializer is "full". I consider the initializer to be "full" if it has all the names and values โโof the arguments (except for the enumeration). For instance:
Here is my test setup (Xcode 7.3, Swift 2.2):
enum Foo { case Bar } class Baz { var iReallyShouldntBeDisplayedHere = 0 init(foo:Foo, string:String) {} init(foo: Foo) {} }
And here is a list of cases when I found an error, and does not happen:
// Enum is the only argument // CORRECT: accepting the initialiser autocomplete (so it 'complete'), then typing "Foo." brings up autocomplete options for enum cases let baz = Baz(foo: Foo.) // CORRECT: typing the initialiser yourself (so it 'incomplete'), then typing "Foo." in the first parameter brings up autocomplete options for enum cases let baz2 = Baz(foo: Foo. // Enum is one argument of many // INCORRECT: accepting the initialiser autocomplete (so it 'semi-complete'), then typing "Foo." in the first parameter brings up Baz instance members ("iReallyShouldntBeDisplayedHere") let baz3 = Baz(foo: Foo., string: <String Placeholder>) // CORRECT: typing the initialiser yourself (so it 'incomplete'), and typing "Foo." in the first parameter brings up enum cases let baz4 = Baz(foo: Foo. // Single dot syntax (where enum is one argument of many) // CORRECT: typing the initialiser yourself (so it 'incomplete'), and typing "." in the first parameter brings up enum cases let baz5 = Baz(foo:. // CORRECT: accepting the initialiser autocomplete (so it 'semi-complete'), then typing "." in the first parameter brings up enum cases let baz6 = Baz(foo:., string: <String Placeholder>) // INCORRECT: modifying the foo: argument once the initialiser is 'complete' by typing "." in the first parameter doesn't generate the autocomplete list let baz7 = Baz(foo:., string: "")
I also tried this when foo: is the last argument, but the initializer should always be complete in this case, so it always fails. I tried with initializers that take 3 arguments, but it looks like they have the same behavior as an initializer with two arguments.
If anyone knows about any cases where this error can be reproduced, I would like to know!