Comment by grishka
4 years ago
Objective-C is the ABI of all UI-related macOS frameworks and it would probably always be. Even if you're writing in Swift, as long as you're using AppKit, you're using Objective-C classes under the hood. There's no such thing as "Swift Cocoa APIs". And SwiftUI is an abstraction layer on top of, again, AppKit/UIKit/WatchKit, which are themselves all written in Objective-C.
That used to be true. https://developer.apple.com/documentation/realitykit/ https://developer.apple.com/documentation/GroupActivities
Then a question: how does one call these APIs from another language? You can use Objective-C frameworks from anything that can call C functions, by manually doing objc_msgSend and all the related stuff. But will you have to write a Swift wrapper for these?
I would guess that's the linker's job?
I don't need to do that in my day to day job, but I do remember that as part of an OS class at school (some 20+ years ago) one of the tasks we were assigned was that we had to work in pairs of teams, where one team would implement a function and another team would implement code that called that function, the only requirement being that both teams had to use different languages. The point of the exercise was to show how, provided you had a defined API, thanks to linking you could use the best language for each job.
1 reply →
Yes, just like on Android you will need to write Java or Kotlin, and the NDK only exposes game development APIs.
Objective-C is done, see WWDC 2022.
On macOS, the Swift ABI is stable. It is different from the C or C++ ABI. Somebody would need to implement the Swift ABI for another language. Which is kinda tricky because Swift has many features that other languages don’t have. Rust could probably do it, or C++ with a ton of templates I guess.