Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

379
Views
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 answers
Answer question

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 Report

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 Report

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!