Monday, October 14, 2024

Swift Foundation Unification

Ben Cohen:

The keynote from Tony [Parker] and me at ServerSideSwift2024 is up. Hear about how Swift interoperability allowed Foundation to make the switch to Swift, and about the latest direction for interoperability: from Swift to Java.

Apple has rewritten Foundation in Swift, and the Objective-C Foundation and Core Foundation now call into the Swift implementation. This improves performance from Swift, as there are fewer conversions, and also generally, as the Swift code has in some cases been optimized to reduce allocations.

The actual Foundation running on Apple’s platforms is now open source! They are working on a simpler review process for minor API proposals and encouraging more proposals from new contributors.

Quinn:

This seems to be a good time to remind folks that…

Those who live by the swizzle will die by the swizzle!

When I was getting started with Cocoa, Apple had just written an Objective-C to Java bridge. Apple emphasized that you could write native apps in Java This was seemingly rarely done, and I opted to use Objective-C even though I had been a Java programmer. I did use the Java bridge to call into a Java library that didn’t have an Objective-C equivalent. It worked well.

Anyway, there’s now a prototype bridge between Swift and Java. There are code generation tools to make it easier to call in both directions.

See also: The Success Story of Server-Side Swift at Cultured Code.

Previously:

3 Comments RSS · Twitter · Mastodon


Well the thing about swizzling is that it’s often done to workaround Apple bugs as a last resort. So thanks for the PSA but I dk if there is anything to be proud of here..


" encouraging more proposals from new contributors."

Gack.

More proposals -> more changes / more complexity / more special cases


Very well done to those that worked on this.

Leave a Comment