Xcode 10 Struct Initializer autoComplete not showing












8















I am defining my viewModels in a separate files as structs, 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?
}

}
}


enter image description here



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...










share|improve this question

























  • Case sensitive mismatch: profile vs Profile

    – vadian
    Sep 26 '18 at 18:39













  • @vadian, sry for the typo, no it was profile but when i posted the question i realize that the p is small so i change it to capital letter without updating the screenshot.

    – mojtaba al moussawi
    Sep 26 '18 at 18:41













  • Having the same issue. This worked perfectly before.

    – Nailer
    Oct 22 '18 at 12:33











  • facing same issue.But it works fine for me when you call its init method.Like: ProfileModels.ViewModels.profile().init....

    – Sakshi
    Nov 23 '18 at 9:54











  • @Sakshi, i hope so, but sometimes isn't working... check my updated question if the problem is still exist with you even with calling the init method...

    – mojtaba al moussawi
    Nov 23 '18 at 10:50
















8















I am defining my viewModels in a separate files as structs, 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?
}

}
}


enter image description here



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...










share|improve this question

























  • Case sensitive mismatch: profile vs Profile

    – vadian
    Sep 26 '18 at 18:39













  • @vadian, sry for the typo, no it was profile but when i posted the question i realize that the p is small so i change it to capital letter without updating the screenshot.

    – mojtaba al moussawi
    Sep 26 '18 at 18:41













  • Having the same issue. This worked perfectly before.

    – Nailer
    Oct 22 '18 at 12:33











  • facing same issue.But it works fine for me when you call its init method.Like: ProfileModels.ViewModels.profile().init....

    – Sakshi
    Nov 23 '18 at 9:54











  • @Sakshi, i hope so, but sometimes isn't working... check my updated question if the problem is still exist with you even with calling the init method...

    – mojtaba al moussawi
    Nov 23 '18 at 10:50














8












8








8








I am defining my viewModels in a separate files as structs, 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?
}

}
}


enter image description here



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...










share|improve this question
















I am defining my viewModels in a separate files as structs, 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?
}

}
}


enter image description here



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...







swift xcode struct xcode10






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 23 '18 at 10:48







mojtaba al moussawi

















asked Sep 26 '18 at 18:34









mojtaba al moussawimojtaba al moussawi

4411413




4411413













  • Case sensitive mismatch: profile vs Profile

    – vadian
    Sep 26 '18 at 18:39













  • @vadian, sry for the typo, no it was profile but when i posted the question i realize that the p is small so i change it to capital letter without updating the screenshot.

    – mojtaba al moussawi
    Sep 26 '18 at 18:41













  • Having the same issue. This worked perfectly before.

    – Nailer
    Oct 22 '18 at 12:33











  • facing same issue.But it works fine for me when you call its init method.Like: ProfileModels.ViewModels.profile().init....

    – Sakshi
    Nov 23 '18 at 9:54











  • @Sakshi, i hope so, but sometimes isn't working... check my updated question if the problem is still exist with you even with calling the init method...

    – mojtaba al moussawi
    Nov 23 '18 at 10:50



















  • Case sensitive mismatch: profile vs Profile

    – vadian
    Sep 26 '18 at 18:39













  • @vadian, sry for the typo, no it was profile but when i posted the question i realize that the p is small so i change it to capital letter without updating the screenshot.

    – mojtaba al moussawi
    Sep 26 '18 at 18:41













  • Having the same issue. This worked perfectly before.

    – Nailer
    Oct 22 '18 at 12:33











  • facing same issue.But it works fine for me when you call its init method.Like: ProfileModels.ViewModels.profile().init....

    – Sakshi
    Nov 23 '18 at 9:54











  • @Sakshi, i hope so, but sometimes isn't working... check my updated question if the problem is still exist with you even with calling the init method...

    – mojtaba al moussawi
    Nov 23 '18 at 10:50

















Case sensitive mismatch: profile vs Profile

– vadian
Sep 26 '18 at 18:39







Case sensitive mismatch: profile vs Profile

– vadian
Sep 26 '18 at 18:39















@vadian, sry for the typo, no it was profile but when i posted the question i realize that the p is small so i change it to capital letter without updating the screenshot.

– mojtaba al moussawi
Sep 26 '18 at 18:41







@vadian, sry for the typo, no it was profile but when i posted the question i realize that the p is small so i change it to capital letter without updating the screenshot.

– mojtaba al moussawi
Sep 26 '18 at 18:41















Having the same issue. This worked perfectly before.

– Nailer
Oct 22 '18 at 12:33





Having the same issue. This worked perfectly before.

– Nailer
Oct 22 '18 at 12:33













facing same issue.But it works fine for me when you call its init method.Like: ProfileModels.ViewModels.profile().init....

– Sakshi
Nov 23 '18 at 9:54





facing same issue.But it works fine for me when you call its init method.Like: ProfileModels.ViewModels.profile().init....

– Sakshi
Nov 23 '18 at 9:54













@Sakshi, i hope so, but sometimes isn't working... check my updated question if the problem is still exist with you even with calling the init method...

– mojtaba al moussawi
Nov 23 '18 at 10:50





@Sakshi, i hope so, but sometimes isn't working... check my updated question if the problem is still exist with you even with calling the init method...

– mojtaba al moussawi
Nov 23 '18 at 10:50












0






active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f52524139%2fxcode-10-struct-initializer-autocomplete-not-showing%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f52524139%2fxcode-10-struct-initializer-autocomplete-not-showing%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Berounka

Sphinx de Gizeh

Different font size/position of beamer's navigation symbols template's content depending on regular/plain...