I am defining my viewModels in a separate files as struct
s, when i am trying to create an instance of this struct
in another file the autocomplete of the memberwise initializer is not showing..
This problem wasn't before(i.e Xcode 9) is it a bug in Xcode 10?
I have seen similar questions like Xcode does not autocomplete memberwise initializer of a Struct
but it's old and the problem was in Xcode 7 or 8 maybe.
However if i place my struct
in the file i am attempting to use it, the autocomplete will be shown, so what's the problem ?
I Also tried .init
after the struct
name with no luck.
Here's my ViewModels :
struct ProfileModels {
struct ViewModels {
struct profile{
let name : URL?
let positionAndCountry : String?
let briefDescription : String?
let hotelInfo : HotelInfo?
}
struct HotelInfo{
let hotelName : String?
let roomClasification : String?
let checkInDate : String?
let checkOutDate : String?
let isCheckInEarly : String?
let isCheckInLate : String?
}
}
}
Update:
As mentioned in the comments that it works fine if the init method called, however sometimes the autocomplete isn't showing with calling the init method...
Anyway for anybody who wants a quick workaround until this bug solved is to use the following:
Create an empty struct (don't worry about the error for now)
example :
ProfileModels.viewModels.profile()
- In a new line, call the struct and the autocomplete will be shown!, now you can delete the first one.
I don't know why this happened but maybe the compiler after the first line will recognize that this struct missing arguments, so they will appear when the same struct used later...