Post

Replies

Boosts

Views

Activity

File not detected by other files upon moving to a folder
Hi, This problem has occurred quite often for me. For example, I declare a file MyStruct.swift struct MyStruct { let memberOne : String let memberTwo : String } I put this into a folder (I personally use the MVC model, so in this case I'm moving this file to the Model folder). Let's say that I have AnotherFile.swift with a view controller with a fairly trivial amount of code and this code block. ... var anArray : [MyStruct] = [ MyStruct(memberOne: "H", memberTwo: "W"), MyString(memberOne: "e", memberTwo: "o") ] ... When the file MyStruct.swift is in the Model folder (i.e. AppName/Model/MyStruct.swift and AppName/AnotherFile.swift), it does the above code block gives an error saying that it doesn't recognize the 'MyStruct'. However as soon as I move the file out of the Model folder (i.e. AppName/MyStruct.swift and AppName/AnotherFile.swift), it compiles fine. I'm not sure why this happens. Any help would be appreciated! I use Xcode 11.5
5
0
6.6k
Jun ’20