Migrating to Swift 3 using Xcode fails

Hi,

I’ve migrated one of my projects to Swift 3 previously, with an earlier beta of Xcode. However, after downloading the GM seed, hundreds of errors pop up in my code, since it appears that Xcode has somehow reverted the compiler back to 2.3. Manually migrating using Edit>Convert>To Current Swift Syntax… always fails, due to the fact that the code had been previously migrated. Is there any way to “manually” migrate the code (i.e. change the compiler settings?)

Thanks,
Saagar Jha

​I think you can just use Xcode's tool that you upgrade to Swift 3.0.
However, I suggest you do a backup of your project first in case this is
not helpful.

Also, the errors you saw were probably not because of Xcode converted you
code to 2.3 automatically. It wouldn't do that. The real reason is that in
Xcode 6 beta6, a lot of Swift 3.0 accepted proposals were implemented and
released, which made the Swift 3.0 far more different from the previous
3.0.

Xcode's migration tool is closed sourced and is not part of Swift. ​If you
have further questions, I suggest you to ask it in Apple's developer forum.

Zhaoxin

···

On Fri, Sep 9, 2016 at 5:01 AM, Saagar Jha via swift-users < swift-users@swift.org> wrote:

Hi,

I’ve migrated one of my projects to Swift 3 previously, with an earlier
beta of Xcode. However, after downloading the GM seed, hundreds of errors
pop up in my code, since it appears that Xcode has somehow reverted the
compiler back to 2.3. Manually migrating using Edit>Convert>To Current
Swift Syntax… always fails, due to the fact that the code had been
previously migrated. Is there any way to “manually” migrate the code (i.e.
change the compiler settings?)

Thanks,
Saagar Jha

_______________________________________________
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users

Hi Saagar,

It might not be your case but if you are getting "No source changes necessary - Click Update to change your target's build settings to use the latest Swift syntax.” message, it might have nothing to do with wrong compiler version. Due to my experiences it looks like generating preview of changes runs build process that fails on code signing. The message in this case can be misleading (I consider it a bug) but try to set your provisioning profiles correctly for both build configurations (make sure certificates are valid) and give it another try (Edit > Convert > To Current Swift Syntax…).

Stano

···

On 08 Sep 2016, at 23:01, Saagar Jha via swift-users <swift-users@swift.org <mailto:swift-users@swift.org>> wrote:

Hi,

I’ve migrated one of my projects to Swift 3 previously, with an earlier beta of Xcode. However, after downloading the GM seed, hundreds of errors pop up in my code, since it appears that Xcode has somehow reverted the compiler back to 2.3. Manually migrating using Edit>Convert>To Current Swift Syntax… always fails, due to the fact that the code had been previously migrated. Is there any way to “manually” migrate the code (i.e. change the compiler settings?)

Thanks,
Saagar Jha

_______________________________________________
swift-users mailing list
swift-users@swift.org <mailto:swift-users@swift.org>
https://lists.swift.org/mailman/listinfo/swift-users

I am aware that there were new proposals, and I’ve been following along and manually migrating. The errors are due to Xcode using the Swift 2.3 compiler, which doesn’t like the new Swift 3 syntax (for example, it’s complaining that it can’t find the new types that have the NS- prefix dropped). I’m just looking for the flag in build settings that switches the compilers.

Saagar Jha

···

On Sep 8, 2016, at 16:47, Zhao Xin <owenzx@gmail.com> wrote:

​I think you can just use Xcode's tool that you upgrade to Swift 3.0. However, I suggest you do a backup of your project first in case this is not helpful.

Also, the errors you saw were probably not because of Xcode converted you code to 2.3 automatically. It wouldn't do that. The real reason is that in Xcode 6 beta6, a lot of Swift 3.0 accepted proposals were implemented and released, which made the Swift 3.0 far more different from the previous 3.0.

Xcode's migration tool is closed sourced and is not part of Swift. ​If you have further questions, I suggest you to ask it in Apple's developer forum.

Zhaoxin

On Fri, Sep 9, 2016 at 5:01 AM, Saagar Jha via swift-users <swift-users@swift.org <mailto:swift-users@swift.org>> wrote:
Hi,

I’ve migrated one of my projects to Swift 3 previously, with an earlier beta of Xcode. However, after downloading the GM seed, hundreds of errors pop up in my code, since it appears that Xcode has somehow reverted the compiler back to 2.3. Manually migrating using Edit>Convert>To Current Swift Syntax… always fails, due to the fact that the code had been previously migrated. Is there any way to “manually” migrate the code (i.e. change the compiler settings?)

Thanks,
Saagar Jha

_______________________________________________
swift-users mailing list
swift-users@swift.org <mailto:swift-users@swift.org>
https://lists.swift.org/mailman/listinfo/swift-users

I
​ am confused with your situation. You said, "I’ve migrated one of my
projects to Swift 3 previously, with an earlier beta of Xcode.". Then in
Xcode should not using Swift 2.3. Assuming
​X
​code using 2.3 wrongly, you should use Xcode migration tool again, after
that Xcode will use Swift 3.0. You manually change code will not cause
Xcode using Swift 3.0 automatically.

Zhaoxin​

···

On Fri, Sep 9, 2016 at 10:26 AM, Saagar Jha <saagar@saagarjha.com> wrote:

I am aware that there were new proposals, and I’ve been following along
and manually migrating. The errors are due to Xcode using the Swift 2.3
compiler, which doesn’t like the new Swift 3 syntax (for example, it’s
complaining that it can’t find the new types that have the NS- prefix
dropped). I’m just looking for the flag in build settings that switches the
compilers.

Saagar Jha

On Sep 8, 2016, at 16:47, Zhao Xin <owenzx@gmail.com> wrote:

​I think you can just use Xcode's tool that you upgrade to Swift 3.0.
However, I suggest you do a backup of your project first in case this is
not helpful.

Also, the errors you saw were probably not because of Xcode converted you
code to 2.3 automatically. It wouldn't do that. The real reason is that in
Xcode 6 beta6, a lot of Swift 3.0 accepted proposals were implemented and
released, which made the Swift 3.0 far more different from the previous
3.0.

Xcode's migration tool is closed sourced and is not part of Swift. ​If you
have further questions, I suggest you to ask it in Apple's developer forum.

Zhaoxin

On Fri, Sep 9, 2016 at 5:01 AM, Saagar Jha via swift-users < > swift-users@swift.org> wrote:

Hi,

I’ve migrated one of my projects to Swift 3 previously, with an earlier
beta of Xcode. However, after downloading the GM seed, hundreds of errors
pop up in my code, since it appears that Xcode has somehow reverted the
compiler back to 2.3. Manually migrating using Edit>Convert>To Current
Swift Syntax… always fails, due to the fact that the code had been
previously migrated. Is there any way to “manually” migrate the code (i.e.
change the compiler settings?)

Thanks,
Saagar Jha

_______________________________________________
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users

Ok, here’s what happened:

1. I had a project that used Swift 2.3 with Xcode 7.
2. I downloaded Xcode 8 beta 1 and used the migrator to migrate to Swift 3 (successfully).
3. I downloaded the Xcode 8 betas, fixing errors as they cropped up due to new proposals.
4. I downloaded Xcode 8 GM, and the project now fails to build due to it reverting back to the 2.3 compiler when I right when opened it (I have no idea how this happened).
5. I trigger the migrator manually, which warns that the project is already on Swift 3. I force it to go through anyways, hoping to have it swap the compiler. It proposes no source changes (since I’ve already done this in previous betas) and it then “fails” for whatever reason.
6. It’s still using the old compiler and my code fails to build.

Saagar Jha

···

On Sep 8, 2016, at 19:33, Zhao Xin <owenzx@gmail.com> wrote:

I​ am confused with your situation. You said, "I’ve migrated one of my projects to Swift 3 previously, with an earlier beta of Xcode.". Then in Xcode should not using Swift 2.3. Assuming ​X​code using 2.3 wrongly, you should use Xcode migration tool again, after that Xcode will use Swift 3.0. You manually change code will not cause Xcode using Swift 3.0 automatically.

Zhaoxin​

On Fri, Sep 9, 2016 at 10:26 AM, Saagar Jha <saagar@saagarjha.com <mailto:saagar@saagarjha.com>> wrote:
I am aware that there were new proposals, and I’ve been following along and manually migrating. The errors are due to Xcode using the Swift 2.3 compiler, which doesn’t like the new Swift 3 syntax (for example, it’s complaining that it can’t find the new types that have the NS- prefix dropped). I’m just looking for the flag in build settings that switches the compilers.

Saagar Jha

On Sep 8, 2016, at 16:47, Zhao Xin <owenzx@gmail.com <mailto:owenzx@gmail.com>> wrote:

​I think you can just use Xcode's tool that you upgrade to Swift 3.0. However, I suggest you do a backup of your project first in case this is not helpful.

Also, the errors you saw were probably not because of Xcode converted you code to 2.3 automatically. It wouldn't do that. The real reason is that in Xcode 6 beta6, a lot of Swift 3.0 accepted proposals were implemented and released, which made the Swift 3.0 far more different from the previous 3.0.

Xcode's migration tool is closed sourced and is not part of Swift. ​If you have further questions, I suggest you to ask it in Apple's developer forum.

Zhaoxin

On Fri, Sep 9, 2016 at 5:01 AM, Saagar Jha via swift-users <swift-users@swift.org <mailto:swift-users@swift.org>> wrote:
Hi,

I’ve migrated one of my projects to Swift 3 previously, with an earlier beta of Xcode. However, after downloading the GM seed, hundreds of errors pop up in my code, since it appears that Xcode has somehow reverted the compiler back to 2.3. Manually migrating using Edit>Convert>To Current Swift Syntax… always fails, due to the fact that the code had been previously migrated. Is there any way to “manually” migrate the code (i.e. change the compiler settings?)

Thanks,
Saagar Jha

_______________________________________________
swift-users mailing list
swift-users@swift.org <mailto:swift-users@swift.org>
https://lists.swift.org/mailman/listinfo/swift-users

6. It’s still using the old compiler and my code fails to build.

Select your target. Click on the Build Settings Tab. Scroll down to the Swift Compiler - Version group and change Use Legacy Swift Language Version from Yes to No.

I haven’t a clue if that will actually work. It’s worth a try, though.

Marc

Xcode and migration aren't part of the Swift open source project, but this is something I've heard other people complaining about. Can you please file a Radar if you haven't already (bugreport.apple.com) and include your project file, then send me the bug number? (For this particular issue, I think we can get away with just the xcodeproj rather than the entire project sources that we'd usually need.)

Thanks,
Jordan

···

On Sep 8, 2016, at 19:51, Saagar Jha via swift-users <swift-users@swift.org> wrote:

Ok, here’s what happened:

1. I had a project that used Swift 2.3 with Xcode 7.
2. I downloaded Xcode 8 beta 1 and used the migrator to migrate to Swift 3 (successfully).
3. I downloaded the Xcode 8 betas, fixing errors as they cropped up due to new proposals.
4. I downloaded Xcode 8 GM, and the project now fails to build due to it reverting back to the 2.3 compiler when I right when opened it (I have no idea how this happened).
5. I trigger the migrator manually, which warns that the project is already on Swift 3. I force it to go through anyways, hoping to have it swap the compiler. It proposes no source changes (since I’ve already done this in previous betas) and it then “fails” for whatever reason.
6. It’s still using the old compiler and my code fails to build.

Saagar Jha

On Sep 8, 2016, at 19:33, Zhao Xin <owenzx@gmail.com <mailto:owenzx@gmail.com>> wrote:

I​ am confused with your situation. You said, "I’ve migrated one of my projects to Swift 3 previously, with an earlier beta of Xcode.". Then in Xcode should not using Swift 2.3. Assuming ​X​code using 2.3 wrongly, you should use Xcode migration tool again, after that Xcode will use Swift 3.0. You manually change code will not cause Xcode using Swift 3.0 automatically.

Zhaoxin​

On Fri, Sep 9, 2016 at 10:26 AM, Saagar Jha <saagar@saagarjha.com <mailto:saagar@saagarjha.com>> wrote:
I am aware that there were new proposals, and I’ve been following along and manually migrating. The errors are due to Xcode using the Swift 2.3 compiler, which doesn’t like the new Swift 3 syntax (for example, it’s complaining that it can’t find the new types that have the NS- prefix dropped). I’m just looking for the flag in build settings that switches the compilers.

Saagar Jha

On Sep 8, 2016, at 16:47, Zhao Xin <owenzx@gmail.com <mailto:owenzx@gmail.com>> wrote:

​I think you can just use Xcode's tool that you upgrade to Swift 3.0. However, I suggest you do a backup of your project first in case this is not helpful.

Also, the errors you saw were probably not because of Xcode converted you code to 2.3 automatically. It wouldn't do that. The real reason is that in Xcode 6 beta6, a lot of Swift 3.0 accepted proposals were implemented and released, which made the Swift 3.0 far more different from the previous 3.0.

Xcode's migration tool is closed sourced and is not part of Swift. ​If you have further questions, I suggest you to ask it in Apple's developer forum.

Zhaoxin

On Fri, Sep 9, 2016 at 5:01 AM, Saagar Jha via swift-users <swift-users@swift.org <mailto:swift-users@swift.org>> wrote:
Hi,

I’ve migrated one of my projects to Swift 3 previously, with an earlier beta of Xcode. However, after downloading the GM seed, hundreds of errors pop up in my code, since it appears that Xcode has somehow reverted the compiler back to 2.3. Manually migrating using Edit>Convert>To Current Swift Syntax… always fails, due to the fact that the code had been previously migrated. Is there any way to “manually” migrate the code (i.e. change the compiler settings?)

Thanks,
Saagar Jha

_______________________________________________
swift-users mailing list
swift-users@swift.org <mailto:swift-users@swift.org>
https://lists.swift.org/mailman/listinfo/swift-users

_______________________________________________
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users

Thanks, I’ve filed rdar://problem/28230945 <rdar://problem/28230945> with the xcodeproj.

Saagar Jha

···

On Sep 9, 2016, at 10:03, Jordan Rose <jordan_rose@apple.com> wrote:

Xcode and migration aren't part of the Swift open source project, but this is something I've heard other people complaining about. Can you please file a Radar if you haven't already (bugreport.apple.com <Feedback Assistant) and include your project file, then send me the bug number? (For this particular issue, I think we can get away with just the xcodeproj rather than the entire project sources that we'd usually need.)

Thanks,
Jordan

On Sep 8, 2016, at 19:51, Saagar Jha via swift-users <swift-users@swift.org <mailto:swift-users@swift.org>> wrote:

Ok, here’s what happened:

1. I had a project that used Swift 2.3 with Xcode 7.
2. I downloaded Xcode 8 beta 1 and used the migrator to migrate to Swift 3 (successfully).
3. I downloaded the Xcode 8 betas, fixing errors as they cropped up due to new proposals.
4. I downloaded Xcode 8 GM, and the project now fails to build due to it reverting back to the 2.3 compiler when I right when opened it (I have no idea how this happened).
5. I trigger the migrator manually, which warns that the project is already on Swift 3. I force it to go through anyways, hoping to have it swap the compiler. It proposes no source changes (since I’ve already done this in previous betas) and it then “fails” for whatever reason.
6. It’s still using the old compiler and my code fails to build.

Saagar Jha

On Sep 8, 2016, at 19:33, Zhao Xin <owenzx@gmail.com <mailto:owenzx@gmail.com>> wrote:

I​ am confused with your situation. You said, "I’ve migrated one of my projects to Swift 3 previously, with an earlier beta of Xcode.". Then in Xcode should not using Swift 2.3. Assuming ​X​code using 2.3 wrongly, you should use Xcode migration tool again, after that Xcode will use Swift 3.0. You manually change code will not cause Xcode using Swift 3.0 automatically.

Zhaoxin​

On Fri, Sep 9, 2016 at 10:26 AM, Saagar Jha <saagar@saagarjha.com <mailto:saagar@saagarjha.com>> wrote:
I am aware that there were new proposals, and I’ve been following along and manually migrating. The errors are due to Xcode using the Swift 2.3 compiler, which doesn’t like the new Swift 3 syntax (for example, it’s complaining that it can’t find the new types that have the NS- prefix dropped). I’m just looking for the flag in build settings that switches the compilers.

Saagar Jha

On Sep 8, 2016, at 16:47, Zhao Xin <owenzx@gmail.com <mailto:owenzx@gmail.com>> wrote:

​I think you can just use Xcode's tool that you upgrade to Swift 3.0. However, I suggest you do a backup of your project first in case this is not helpful.

Also, the errors you saw were probably not because of Xcode converted you code to 2.3 automatically. It wouldn't do that. The real reason is that in Xcode 6 beta6, a lot of Swift 3.0 accepted proposals were implemented and released, which made the Swift 3.0 far more different from the previous 3.0.

Xcode's migration tool is closed sourced and is not part of Swift. ​If you have further questions, I suggest you to ask it in Apple's developer forum.

Zhaoxin

On Fri, Sep 9, 2016 at 5:01 AM, Saagar Jha via swift-users <swift-users@swift.org <mailto:swift-users@swift.org>> wrote:
Hi,

I’ve migrated one of my projects to Swift 3 previously, with an earlier beta of Xcode. However, after downloading the GM seed, hundreds of errors pop up in my code, since it appears that Xcode has somehow reverted the compiler back to 2.3. Manually migrating using Edit>Convert>To Current Swift Syntax… always fails, due to the fact that the code had been previously migrated. Is there any way to “manually” migrate the code (i.e. change the compiler settings?)

Thanks,
Saagar Jha

_______________________________________________
swift-users mailing list
swift-users@swift.org <mailto:swift-users@swift.org>
https://lists.swift.org/mailman/listinfo/swift-users

_______________________________________________
swift-users mailing list
swift-users@swift.org <mailto:swift-users@swift.org>
https://lists.swift.org/mailman/listinfo/swift-users