Search code examples
swiftxcodeswiftuiarchive

External extensions don't work when archive


I have some files in my project dedicated to extension for Colors, string and images like this

extension Color{
     static var mimotoPrimary: Color{
         Color("mimoto_primary")
     }

     static var mimotoPrimaryLight: Color{
         Color("mimoto_primary_light")
     }

     static var mimotoWhiteDark: Color{
         Color("white_dark")
     }

      ...
}

It's pretty simple. This extensions works perfectly when building and running. However when I try to archive this errors appear enter image description here

None of the extensions I have works.

I have set the schemes to be the same when Running than when archiving and even doing that running goes well and archiving goes wrong.

I'm using XCode 13.1

Any idea?


Solution

  • Well, the error resided in the project folder structure. This is how I had my project sructure: enter image description here

    It turns out that for some reason those files are not detected in that folder, instead, they needed to be in any other folder. This worked:

    enter image description here

    However I don't the reason of this issue, the first project structure worked well when building and running.