Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

384
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar

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 Denunciar

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda