Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

385
Visualizações
Xcode 10.2 convert multiple targets to Swift 5: Tries to compile some classes that are not part of target

I have an iOS Swift project with multiple targets.

Converting the first target to Swift 5 was easy.

Converting the second target to Swift 5, Xcode 10.2 tries to compile files that clearly exist only in the first target and fails (Because it doesn't compile all files of the first target and complains about unresolved identifiers).

What can I do that Xcode compiles only those files, that are part of the target while converting to Swift 5?

How can I convert my project to Swift 5?

Cleaning the Build folder and restarting Xcode 10.2 doesn't help.

over 4 years ago · Santiago Trujillo
3 Respostas
Responde à pergunta

0

I just went through this process and was able to figure out a fairly simple solution from a hint in the last sentence of the Migration Guide https://swift.org/migration-guide-swift5/

When I tried to convert each target individually in my project, the second target would fail because of shared code with the first target that had already been converted. The solution is to create a new scheme that includes all of the targets that need to be migrated in a single pass.

  1. Click on the scheme button to get the drop down and select "New Scheme..."

  2. Create the scheme and then select it in the drop down and choose "Edit Scheme..."

  3. Under the "Build" section use the "+" button to add all of the targets you need to convert to the scheme.

  4. Build the new scheme with the current Swift version to confirm that all targets build correctly.

  5. Use Edit -> Convert -> "To Current Swift Syntax..." to start the conversion

This worked for me in a project with 15 targets with lots of shared Swift code that was in version 4.0.

over 4 years ago · Santiago Trujillo Relatório

0

I found a workaround:

  1. reset project to state before conversion.
  2. convert the target with the fewest classes (not containing the files in the error message of the first attempt)
  3. convert target for target, including more and more files
  4. convert test targets

With this approach I was able to convert my project.

(See also the comment of Cœur, I think their manual conversion would work, too)

over 4 years ago · Santiago Trujillo Relatório

0

It's not clear to me what the issue is, if you could file a bug report at http://bugreport.apple.com, the team at Apple will follow-up with you.

Note that there is a migration guide that you may find helpful here: https://swift.org/migration-guide-swift5

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda