Can Swift 2.3 frameworks be used with a Swift 3.0 app?


(Ted Bradley) #1

Can Swift 2.3 frameworks be used with a Swift 3.0 target app?

From what I’m reading in the documentation, it seems like everything needs to be either all Swift 2.3 or all Swift 3.0 – no mix and matching.

Unfortunately, the beta has been pretty unstable on my system so I’ve not managed to get enough time to test this out yet. Appreciate hearing from anyone who knows definitively or has tried this.


(Zhao Xin) #2

I don't know which frameworks you talking about. The Foundation framework
is definitely different. But Cocoa and Cocoa Touch should be the same.

Zhaoxin

···

On Mon, Jun 27, 2016 at 6:04 PM, Ted Bradley via swift-users < swift-users@swift.org> wrote:

Can Swift 2.3 frameworks be used with a Swift 3.0 target app?

From what I’m reading in the documentation, it seems like everything needs
to be either all Swift 2.3 or all Swift 3.0 – no mix and matching.

Unfortunately, the beta has been pretty unstable on my system so I’ve not
managed to get enough time to test this out yet. Appreciate hearing from
anyone who knows definitively or has tried this.

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


(Ted Bradley) #3

Ah, I wasn’t being clear :slight_smile:

I meant user created frameworks. Such as you would get manually or via Carthage / Cocoapods. Could those be migrated to Swift 2.3, whilst your main target is migrated to Swift 3.0?

As a temporary stop-gap of course.

···

From: zh ao <owenzx@gmail.com>
Date: Monday, 27 June 2016 at 11:27
To: Ted Bradley <ted.bradley@hudl.com>
Cc: "swift-users@swift.org" <swift-users@swift.org>
Subject: Re: [swift-users] Can Swift 2.3 frameworks be used with a Swift 3.0 app?

I don't know which frameworks you talking about. The Foundation framework is definitely different. But Cocoa and Cocoa Touch should be the same.

Zhaoxin

On Mon, Jun 27, 2016 at 6:04 PM, Ted Bradley via swift-users <swift-users@swift.org<mailto:swift-users@swift.org>> wrote:
Can Swift 2.3 frameworks be used with a Swift 3.0 target app?

From what I’m reading in the documentation, it seems like everything needs to be either all Swift 2.3 or all Swift 3.0 – no mix and matching.

Unfortunately, the beta has been pretty unstable on my system so I’ve not managed to get enough time to test this out yet. Appreciate hearing from anyone who knows definitively or has tried this.

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


(Zhao Xin) #4

You need to wait until they are promised to work with 2.3 or 3.0. If you
can get the source code, you can use migration tool and compile the
framework yourself.

Zhaoxin

···

On Mon, Jun 27, 2016 at 6:29 PM, Ted Bradley via swift-users < swift-users@swift.org> wrote:

Ah, I wasn’t being clear :slight_smile:

I meant user created frameworks. Such as you would get manually or via
Carthage / Cocoapods. Could those be migrated to Swift 2.3, whilst your
main target is migrated to Swift 3.0?

As a temporary stop-gap of course.

*From: *zh ao <owenzx@gmail.com>
*Date: *Monday, 27 June 2016 at 11:27
*To: *Ted Bradley <ted.bradley@hudl.com>
*Cc: *"swift-users@swift.org" <swift-users@swift.org>
*Subject: *Re: [swift-users] Can Swift 2.3 frameworks be used with a
Swift 3.0 app?

I don't know which frameworks you talking about. The Foundation framework
is definitely different. But Cocoa and Cocoa Touch should be the same.

Zhaoxin

On Mon, Jun 27, 2016 at 6:04 PM, Ted Bradley via swift-users < > swift-users@swift.org> wrote:

Can Swift 2.3 frameworks be used with a Swift 3.0 target app?

From what I’m reading in the documentation, it seems like everything needs
to be either all Swift 2.3 or all Swift 3.0 – no mix and matching.

Unfortunately, the beta has been pretty unstable on my system so I’ve not
managed to get enough time to test this out yet. Appreciate hearing from
anyone who knows definitively or has tried this.

_______________________________________________
swift-users mailing list
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


(Daniel Dunbar) #5

No, this is not possible. All of the code in a single process needs to be compiled with the same version of Swift.

- Daniel

···

On Jun 27, 2016, at 7:04 AM, Ted Bradley via swift-users <swift-users@swift.org> wrote:

So does that mean then that Swift 2.3 and Swift 3.0 can interoperate?

E.g.

iOS Target ‘Foo’, imports a custom Framework ‘Bar’

Foo is Swift 3.0
Bar is Swift 2.3

From: zh ao <owenzx@gmail.com>
Date: Monday, 27 June 2016 at 14:34
To: Ted Bradley <ted.bradley@hudl.com>
Cc: "swift-users@swift.org" <swift-users@swift.org>
Subject: Re: [swift-users] Can Swift 2.3 frameworks be used with a Swift 3.0 app?

You need to wait until they are promised to work with 2.3 or 3.0. If you can get the source code, you can use migration tool and compile the framework yourself.

Zhaoxin

On Mon, Jun 27, 2016 at 6:29 PM, Ted Bradley via swift-users <swift-users@swift.org <mailto:swift-users@swift.org>> wrote:
Ah, I wasn’t being clear :slight_smile:

I meant user created frameworks. Such as you would get manually or via Carthage / Cocoapods. Could those be migrated to Swift 2.3, whilst your main target is migrated to Swift 3.0?

As a temporary stop-gap of course.

From: zh ao <owenzx@gmail.com <mailto:owenzx@gmail.com>>
Date: Monday, 27 June 2016 at 11:27
To: Ted Bradley <ted.bradley@hudl.com <mailto:ted.bradley@hudl.com>>
Cc: "swift-users@swift.org <mailto:swift-users@swift.org>" <swift-users@swift.org <mailto:swift-users@swift.org>>
Subject: Re: [swift-users] Can Swift 2.3 frameworks be used with a Swift 3.0 app?

I don't know which frameworks you talking about. The Foundation framework is definitely different. But Cocoa and Cocoa Touch should be the same.

Zhaoxin

On Mon, Jun 27, 2016 at 6:04 PM, Ted Bradley via swift-users <swift-users@swift.org <mailto:swift-users@swift.org>> wrote:
Can Swift 2.3 frameworks be used with a Swift 3.0 target app?

From what I’m reading in the documentation, it seems like everything needs to be either all Swift 2.3 or all Swift 3.0 – no mix and matching.

Unfortunately, the beta has been pretty unstable on my system so I’ve not managed to get enough time to test this out yet. Appreciate hearing from anyone who knows definitively or has tried this.

_______________________________________________
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

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


(Jens Alfke) #6

How long will this be the case? The product I work on is distributed primarily as a compiled framework. If we port any of it to Swift we’d first need some assurance of binary compatibility.

(Also, if you really mean all of the code in a process, that implies that Apple can’t implement any system frameworks in Swift. So it seems that this question ties in with the earlier one of “how long do we have to copy multi-megabyte compatibility shim libraries into our apps that use Swift?”)

((At the risk of sounding flamey: this sort of confirms my rule of thumb that Swift version numbers have their decimal points misplaced. IMHO, ABI stability is a requirement for a true 1.0 release of a language that has dynamic loading.))

—Jens

···

On Jun 27, 2016, at 8:30 AM, Daniel Dunbar via swift-users <swift-users@swift.org> wrote:

No, this is not possible. All of the code in a single process needs to be compiled with the same version of Swift.


(Ted Bradley) #7

So does that mean then that Swift 2.3 and Swift 3.0 can interoperate?

E.g.

iOS Target ‘Foo’, imports a custom Framework ‘Bar’

Foo is Swift 3.0
Bar is Swift 2.3

···

From: zh ao <owenzx@gmail.com>
Date: Monday, 27 June 2016 at 14:34
To: Ted Bradley <ted.bradley@hudl.com>
Cc: "swift-users@swift.org" <swift-users@swift.org>
Subject: Re: [swift-users] Can Swift 2.3 frameworks be used with a Swift 3.0 app?

You need to wait until they are promised to work with 2.3 or 3.0. If you can get the source code, you can use migration tool and compile the framework yourself.

Zhaoxin

On Mon, Jun 27, 2016 at 6:29 PM, Ted Bradley via swift-users <swift-users@swift.org<mailto:swift-users@swift.org>> wrote:
Ah, I wasn’t being clear :slight_smile:

I meant user created frameworks. Such as you would get manually or via Carthage / Cocoapods. Could those be migrated to Swift 2.3, whilst your main target is migrated to Swift 3.0?

As a temporary stop-gap of course.

From: zh ao <owenzx@gmail.com<mailto:owenzx@gmail.com>>
Date: Monday, 27 June 2016 at 11:27
To: Ted Bradley <ted.bradley@hudl.com<mailto:ted.bradley@hudl.com>>
Cc: "swift-users@swift.org<mailto:swift-users@swift.org>" <swift-users@swift.org<mailto:swift-users@swift.org>>
Subject: Re: [swift-users] Can Swift 2.3 frameworks be used with a Swift 3.0 app?

I don't know which frameworks you talking about. The Foundation framework is definitely different. But Cocoa and Cocoa Touch should be the same.

Zhaoxin

On Mon, Jun 27, 2016 at 6:04 PM, Ted Bradley via swift-users <swift-users@swift.org<mailto:swift-users@swift.org>> wrote:
Can Swift 2.3 frameworks be used with a Swift 3.0 target app?

From what I’m reading in the documentation, it seems like everything needs to be either all Swift 2.3 or all Swift 3.0 – no mix and matching.

Unfortunately, the beta has been pretty unstable on my system so I’ve not managed to get enough time to test this out yet. Appreciate hearing from anyone who knows definitively or has tried this.

_______________________________________________
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


(Ted Bradley) #8

Thanks – I really appreciate the definitive answer.

I’m worried a lot of people don’t realise this when doing their planning for the next few months – the migration guide is a little bit ambiguous on this front:

“Wait until the upstream open-source project updates to Swift 2.3 or Swift 3”
- https://swift.org/migration-guide/#using-carthagecocoapods-projects

If read optimistically, one could easily think that the update of the upstream open-source project doesn’t have to be to the same Swift version as ones own project...

- Ted

···

From: <daniel_dunbar@apple.com> on behalf of Daniel Dunbar <daniel_dunbar@apple.com>
Date: Monday, 27 June 2016 at 16:30
To: Ted Bradley <ted.bradley@hudl.com>
Cc: "swift-users@swift.org" <swift-users@swift.org>
Subject: Re: [swift-users] Can Swift 2.3 frameworks be used with a Swift 3.0 app?

No, this is not possible. All of the code in a single process needs to be compiled with the same version of Swift.

- Daniel


(Zhao Xin) #9

Not with current Swift 3. Currently, the developing team make efforts on
releasing Swift 3 together with iOS 10 and macOS 10.12 in September.

The primary goal of this release is to solidify and mature the Swift
language and development experience. While source breaking changes to the
language have been the norm for Swift 1 through 3, we would like the Swift
3.x (and Swift 4+) languages to be as source compatible with Swift 3.0 as
reasonably possible. However, this will still be best-effort: if there is a
really good reason to make a breaking change beyond Swift 3, we will
consider it and find the least invasive way to roll out that change (e.g.
by having a long deprecation cycle).

https://github.com/apple/swift-evolution

Zhaoxin

···

On Mon, Jun 27, 2016 at 11:39 PM, Jens Alfke via swift-users < swift-users@swift.org> wrote:

On Jun 27, 2016, at 8:30 AM, Daniel Dunbar via swift-users < > swift-users@swift.org> wrote:

No, this is not possible. All of the code in a single process needs to be
compiled with the same version of Swift.

How long will this be the case? The product I work on is distributed
primarily as a compiled framework. If we port any of it to Swift we’d
first need some assurance of binary compatibility.

(Also, if you really mean *all* of the code in a process, that implies
that Apple can’t implement any system frameworks in Swift. So it seems that
this question ties in with the earlier one of “how long do we have to copy
multi-megabyte compatibility shim libraries into our apps that use Swift?”)

((At the risk of sounding flamey: this sort of confirms my rule of thumb
that Swift version numbers have their decimal points misplaced. IMHO, ABI
stability is a requirement for a true 1.0 release of a language that has
dynamic loading.))

—Jens

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


(Kenny Leung) #10

Hmm… This sounds like a big weakness with the Swift Package Manager.

Since it downloads and compiles sources, frameworks that might otherwise be binary compatible to link with might not build and work when you update your dev tools.

-Kenny

···

On Jun 27, 2016, at 8:59 AM, zh ao via swift-users <swift-users@swift.org> wrote:

Not with current Swift 3. Currently, the developing team make efforts on releasing Swift 3 together with iOS 10 and macOS 10.12 in September.

The primary goal of this release is to solidify and mature the Swift language and development experience. While source breaking changes to the language have been the norm for Swift 1 through 3, we would like the Swift 3.x (and Swift 4+) languages to be as source compatible with Swift 3.0 as reasonably possible. However, this will still be best-effort: if there is a really good reason to make a breaking change beyond Swift 3, we will consider it and find the least invasive way to roll out that change (e.g. by having a long deprecation cycle).

https://github.com/apple/swift-evolution

Zhaoxin​

On Mon, Jun 27, 2016 at 11:39 PM, Jens Alfke via swift-users <swift-users@swift.org> wrote:

On Jun 27, 2016, at 8:30 AM, Daniel Dunbar via swift-users <swift-users@swift.org> wrote:

No, this is not possible. All of the code in a single process needs to be compiled with the same version of Swift.

How long will this be the case? The product I work on is distributed primarily as a compiled framework. If we port any of it to Swift we’d first need some assurance of binary compatibility.

(Also, if you really mean all of the code in a process, that implies that Apple can’t implement any system frameworks in Swift. So it seems that this question ties in with the earlier one of “how long do we have to copy multi-megabyte compatibility shim libraries into our apps that use Swift?”)

((At the risk of sounding flamey: this sort of confirms my rule of thumb that Swift version numbers have their decimal points misplaced. IMHO, ABI stability is a requirement for a true 1.0 release of a language that has dynamic loading.))

—Jens

_______________________________________________
swift-users mailing list
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


(Jens Alfke) #11

Not with current Swift 3. Currently, the developing team make efforts on releasing Swift 3 together with iOS 10 and macOS 10.12 in September.

I know it’s not with Swift 3. Hopefully people on the dev team are thinking farther ahead.

The primary goal of this release is to solidify and mature the Swift language and development experience. While source breaking changes to the language have been the norm for Swift 1 through 3, we would like the Swift 3.x (and Swift 4+) languages to be as source compatible with Swift 3.0 as reasonably possible.

I’m asking about binary compatibility, not source compatibility; they’re not the same. For example, the Objective-C language has gone through many major changes since 2001, but the runtime has only broken binary compatibility once (and that was done in a way that didn’t affect any existing code, by putting it into the 64-bit transition on OS X and into the brand-new iOS.)

—Jens

···

On Jun 27, 2016, at 8:59 AM, zh ao <owenzx@gmail.com> wrote:


(Dmitri Gribenko) #12

Swift 2.3 and 3.0 are not binary compatible.

Dmitri

···

On Mon, Jun 27, 2016 at 9:05 AM, Kenny Leung via swift-users <swift-users@swift.org> wrote:

Hmm… This sounds like a big weakness with the Swift Package Manager.

Since it downloads and compiles sources, frameworks that might otherwise be binary compatible to link with might not build and work when you update your dev tools.

--
main(i,j){for(i=2;;i++){for(j=2;j<i;j++){if(!(i%j)){j=0;break;}}if
(j){printf("%d\n",i);}}} /*Dmitri Gribenko <gribozavr@gmail.com>*/