objc2 icon indicating copy to clipboard operation
objc2 copied to clipboard

List of frameworks to translate

Open silvanshade opened this issue 2 years ago • 19 comments

This is a list of frameworks I've been working through in the translation PRs.

This is basically just what shows up on the Apple website under system frameworks, technologies page, the SDK directories, etc.

Some of these are obsolete and probably not worth bothering with. Several have issues that will prevent translation until more work is done on the translator (e.g., the core foundation stuff). Some give errors related to seemingly not finding the header files (not sure why, but I've added notes about those below).

Some are only available in Swift and I guess this will only increase in the future. It would be nice if we could figure out a way to still include bindings for those but I suppose it might require building out some new tooling?

  • [ ] Accelerate
  • [x] Accessibility
  • [ ] Accounts (deprecated)
  • [ ] AddressBook + AddressBookUI.h
  • [ ] ActivityKit (swift)
  • [x] AdServices
  • [x] AdSupport
  • [ ] AGL (deprecated)
  • [ ] AppClip
  • [ ] AppIntents (swift)
  • [x] AppKit
  • [ ] AppleArchive
  • [ ] AppleCryptoKit (swift)
  • [ ] AppleScriptKit
  • [ ] AppleScriptObjC
  • [ ] ApplicationServices (needs Carbon stuff)
  • [x] AppTrackingTransparency (doesn't find header?)
  • [ ] ARKit (needs iOS?)
  • [ ] AssetsLibrary (deprecated, needs iOS)
  • [ ] AudioDriverKit
  • [ ] AudioToolbox
  • [ ] AudioUnit
  • [ ] AudioVideoBridging
  • [x] AuthenticationServices
  • [x] AutomaticAssessmentConfiguration
  • [x] Automator
  • [ ] AVFAudio
  • [ ] AVFKit
  • [ ] AVFoundation
  • [ ] AVRouting
  • [x] BackgroundAssets
  • [x] BackgroundTasks
  • [ ] BlockStorageDeviceDriverKit
  • [x] BusinessChat
  • [ ] CalendarStore (deprecated?)
  • [x] CallKit
  • [ ] Carbon
  • [ ] CareKit
  • [ ] CarKey (requires special entitlement)
  • [ ] CarPlay (catalyst / iOS)
  • [ ] CFNetwork
  • [ ] CHIP
  • [x] ClassKit
  • [ ] ClockKit (catalyst)
  • [x] CloudKit
  • [ ] Cocoa
  • [ ] Collaboration (needs CoreServices and Security)
  • [ ] ColorSync
  • [ ] Combine (swift)
  • [ ] Compression
  • [x] Contacts
  • [x] ContactsUI
  • [ ] CoreAudio
  • [ ] CoreAudioKit
  • [ ] CoreAudioTypes
  • [ ] CoreBluetooth
  • [x] CoreData
  • [ ] CoreDisplay
  • [x] CoreFoundation
  • [ ] CoreGraphics
  • [ ] CoreHaptics
  • [ ] CoreImage
  • [x] CoreLocation
  • [ ] CoreLocationUI
  • [ ] CoreMedia
  • [ ] CoreMediaIO
  • [ ] CoreMIDI
  • [ ] CoreMIDIServer
  • [ ] CoreML
  • [ ] CoreMotion
  • [ ] CoreNFC
  • [ ] CoreServices
  • [ ] CoreSpotlight
  • [ ] CoreTelephony
  • [ ] CoreText
  • [ ] CoreTransferrable
  • [ ] CoreVideo
  • [x] CoreWLAN
  • [ ] CreateML (swift)
  • [ ] CreateMLComponents (swift)
  • [ ] CryptoTokenKit
  • [ ] DeviceActivity
  • [ ] DarwinNotify
  • [x] DataDetection
  • [ ] DeveloperToolsSupport (swift)
  • [ ] DeviceActivity
  • [x] DeviceCheck
  • [ ] DeviceDiscoveryExtension
  • [ ] DeviceDiscoveryUI
  • [ ] DeviceManagement
  • [ ] DirectoryService
  • [ ] DiskArbitration (doesn't find header?) (needs CoreFoundation?)
  • [ ] DiskRecording (deprecated?)
  • [ ] DiskRecordingUI (deprecated?)
  • [ ] dispatch
  • [ ] Distributed (swift)
  • [ ] dnssd
  • [ ] DocC
  • [ ] DriverKit
  • [ ] DVDPlayback (deprecated?)
  • [ ] Endpoint Security
  • [x] EventKit
  • [ ] EventKitUI
  • [x] ExceptionHandling
  • [ ] ExecutionPolicy (doesn't find header?)
  • [ ] ExposureNotification
  • [ ] ExtensionFoundation (swift)
  • [x] ExtensionKit
  • [x] ExternalAccessory
  • [ ] FamilyControls (swift)
  • [x] FileProvider
  • [x] FileProviderUI
  • [ ] FinderSync (doesn't find header?)
  • [ ] ForceFeedback (doesn't find header?)
  • [ ] FWAUserLib
  • [x] GameController
  • [x] GameKit
  • [ ] GameplayKit (needs SIMD typedefs)
  • [ ] GLKit
  • [ ] GLUT
  • [ ] GroupActivities (swift)
  • [ ] GSS
  • [x] HealthKit
  • [ ] HIDDriverKit
  • [ ] HomeKit
  • [ ] Hypervisor
  • [ ] iAd
  • [ ] ICADevices
  • [x] IdentityLookup
  • [ ] ImageCaptureCore
  • [ ] ImageIO
  • [ ] IMServicePlugIn
  • [x] InputMethodKit
  • [ ] InstallerJS
  • [ ] InstallerPlugins
  • [ ] InstantMessage
  • [ ] Intents
  • [ ] IntentsUI
  • [ ] IOBluetooth
  • [ ] IOBluetoothUI
  • [ ] IOKit
  • [ ] IOSurface
  • [ ] IOUSBHost
  • [ ] iTunesLibrary
  • [ ] JavaNativeFoundation
  • [ ] JavaRuntimeSupport
  • [ ] JavaScriptCore
  • [ ] Kerberos
  • [ ] Kernel
  • [ ] KernelManagement
  • [ ] LatentSemanticMapping
  • [ ] LDAP
  • [x] LinkPresentation
  • [x] LocalAuthentication
  • [x] LocalAuthenticationEmbeddedUI
  • [x] MailKit
  • [ ] ManagedSettings (swift)
  • [ ] ManagedSettingsUI (swift)
  • [x] MapKit
  • [ ] Matter (requires raising recursion limit to higher than 1024; never saw it finish compiling)
  • [ ] MatterSupport
  • [ ] MediaAccessibility
  • [ ] MediaLibrary
  • [x] MediaPlayer
  • [ ] MediaSetup
  • [ ] MediaToolbox
  • [ ] Messages
  • [ ] MessageUI
  • [x] Metal
  • [x] MetalFX
  • [x] MetalKit
  • [ ] MetalPerformanceShaders
  • [ ] MetalPerformanceShadersGraph
  • [x] MetricKit
  • [ ] MLCompute
  • [ ] ModelIO (needs SIMD typedefs)
  • [x] MultipeerConnectivity
  • [ ] MusicKit (swift)
  • [x] NaturalLanguage
  • [x] NearbyInteraction
  • [ ] NetFS
  • [ ] Network
  • [ ] NetworkingDriverKit
  • [x] NetworkExtension
  • [ ] NewsstandKit
  • [ ] NotificationCenter
  • [x] ObjectiveCRuntime
  • [ ] OpenAL
  • [ ] OpenCL
  • [ ] OpenDirectory
  • [ ] OpenGL
  • [ ] OpenGLES
  • [ ] os
  • [x] OSAKit
  • [ ] OSLog
  • [ ] PackageDescription (swift)
  • [ ] ParavirtualizedGraphics
  • [ ] PassKit
  • [ ] PCIDriverKit
  • [ ] PCSC
  • [ ] PDFKit
  • [ ] PencilKit
  • [ ] PHASE (needs AVFoundation and CoreMedia)
  • [x] PhotoKit
  • [ ] PlaygroundBluetooth (swift)
  • [ ] PlaygroundSupport (swift)
  • [ ] PreferencePanes
  • [ ] ProximityReader (swift)
  • [ ] PushKit
  • [ ] PushToTalk
  • [ ] Quartz
  • [ ] QuartzCore
  • [ ] QuickLook
  • [ ] QuickLookThumbnailing
  • [ ] QuickLookUI
  • [ ] RealityKit
  • [ ] RegexBuilder (swift)
  • [ ] ReplayKit
  • [ ] ResearchKit
  • [ ] RoomPlan (swift)
  • [ ] SafariServices
  • [ ] SafetyKit
  • [ ] SceneKit (needs ModelIO and CoreGraphics)
  • [ ] ScreenCaptureKit
  • [ ] ScreenSaver
  • [ ] ScreenTime
  • [ ] ScriptingBridge
  • [ ] SCSIControllerDriverKit
  • [ ] SCSIPeripheralsDriverKit
  • [ ] Security
  • [ ] SecurityFoundation
  • [ ] SecurityInterface
  • [ ] SensorKit
  • [ ] SerialDriverKit
  • [ ] ServiceManagement
  • [ ] ShazamKit
  • [ ] simd
  • [ ] SiriCloudMedia
  • [ ] SiriKit
  • [ ] Social
  • [x] SoundAnalysis
  • [ ] Spatial
  • [x] Speech
  • [ ] SpriteKit (needs SIMD typedefs)
  • [x] StoreKit
  • [ ] StoreKitTest
  • [ ] SyncServices
  • [ ] SwiftCharts
  • [ ] SwiftUI
  • [ ] System
  • [ ] SystemConfiguration
  • [ ] SystemExtensions
  • [ ] TabularData
  • [ ] Tcl
  • [ ] ThreadNetwork
  • [ ] TVML
  • [ ] TVMLKit
  • [ ] TVServices
  • [ ] TVUIKit
  • [ ] TWAIN
  • [x] UIKit
  • [x] UniformTypeIdentifiers
  • [ ] USBDriverKit
  • [ ] USBSerialDriverKit
  • [x] UserNotifications
  • [ ] UserNotificationsUI
  • [ ] VideoDecodeAcceleration
  • [ ] VideoSubscriberAccount
  • [ ] VideoToolbox
  • [ ] Virtualization
  • [x] Vision
  • [ ] VisionKit
  • [ ] vmnet
  • [ ] WatchConnectivity
  • [ ] WatchKit
  • [ ] WeatherKit (swift)
  • [x] WebKit
  • [ ] WidgetKit (swift)
  • [ ] XcodeKit
  • [ ] xcselect
  • [ ] XCTest
  • [ ] XPC

silvanshade avatar Jan 24 '23 06:01 silvanshade

Some are only available in Swift and I guess this will only increase in the future. It would be nice if we could figure out a way to still include bindings for those but I suppose it might require building out some new tooling?

Indeed, that's basically doing the entirety of objc2, just in a new language (people have already begun in swift-rs, swift-bridge and swift-bindgen), and that will, well, take a lot of work.

In any case, I suspect it will be years before Apple releases a Swift-only frameworks that an application developer actually needs to use (SwiftUI is still very much in its early stages). So let's tackle that when the need arises!

madsmtm avatar Jan 26 '23 11:01 madsmtm

In any case, I suspect it will be years before Apple releases a Swift-only frameworks that an application developer actually needs to use (SwiftUI is still very much in its early stages). So let's tackle that when the need arises!

I agree that it probably won't become mandatory for quite some time. Still, it's a little disappointing that some of the newer technologies will be unavailable.

I wonder how feasible it would be to write some sort of objective-c bridging modules for those few cases and then run the translator against that. It wouldn't be a fully automatic process but maybe worth experimenting with?

Another possibility would be to more seriously consider the approach you described in #345. I only looked at it briefly so far, but it seems that if we were to build against that implementation, we could take advantage of the clang module importer (for objective-C frameworks), on the one hand, but also be able to re-use most of the same infrastructure for importing swift modules, right? As I understand it, most of the work we would need to do would be to implement a new code generator that maps the swift module AST (whether it is synthesized from objective-C or directly from native swift) to our rust equivalent.

silvanshade avatar Jan 27 '23 00:01 silvanshade

I wonder how feasible it would be to write some sort of objective-c bridging modules for those few cases and then run the translator against that. It wouldn't be a fully automatic process but maybe worth experimenting with?

You mean modules that use Swift's @objc attributes? + some generated headers? Or is there some mechanism for using Swift from inside Objective-C that I'm not aware of?

Another possibility would be to more seriously consider the approach you described in #345. I only looked at it briefly so far, but it seems that if we were to build against that implementation, we could take advantage of the clang module importer (for objective-C frameworks), on the one hand

I am seriously considering that approach, it's honestly the only sustainable option, header-translator is a hack that has to go one day.

be able to re-use most of the same infrastructure for importing swift modules, right?

Probably, and you do make a good point about it being a good starting point for it!

As I understand it, most of the work we would need to do would be to implement a new code generator that maps the swift module AST (whether it is synthesized from objective-C or directly from native swift) to our rust equivalent.

I honestly don't think that part will be too difficult, if we get the above-mentioned setup for it.

Rather, I worry that getting the ABI and calling convention right (which is still not done for objc2) will take a lot of time, or perhaps more aptly, mental bandwidth (there's a lot to learn!), especially if we need to handle generics.


Anyhow, sorry for my dismissiveness, I think I'm just focused on getting objc2 v0.3 done (I have been working on it for more than 18 months now, would be nice to actually finally release something useful into the hands of users) - this is also why I'm punting on #345, since it will take time that I would rather be focusing elsewhere.

So it's not that I don't want to work on/support Swift, it's just that I can neither allocate the time nor energy for it, nor promise that I will be able to, sorry about that :/

madsmtm avatar Jan 27 '23 21:01 madsmtm

You mean modules that use Swift's @objc attributes? + some generated headers? Or is there some mechanism for using Swift from inside Objective-C that I'm not aware of?

Yeah, probably something like that. I'm not entirely certain how it would work out since I've barely used Swift, but it at least seems plausible that something like that could be done, at least on a smaller scale, and with enough effort. But that's something to worry about later I guess.

Anyhow, sorry for my dismissiveness, I think I'm just focused on getting objc2 v0.3 done (I have been working on it for more than 18 months now, would be nice to actually finally release something useful into the hands of users) - this is also why I'm punting on #345, since it will take time that I would rather be focusing elsewhere.

So it's not that I don't want to work on/support Swift, it's just that I can neither allocate the time nor energy for it, nor promise that I will be able to, sorry about that :/

Yeah, that's perfectly reasonable. I'm mostly just thinking out loud here as far as what it would take to get closer to a complete translation of these frameworks.

I agree that in the near term it's more important to focus on ironing out some of the current issues and working toward getting the next release out.

silvanshade avatar Jan 27 '23 23:01 silvanshade

@madsmtm is it currently possible to run the translator for different platforms (e.g., iOS, tvOS, watchOS)? Some of these frameworks are only available on certain platforms and it would be nice to include them.

Also, what about Catalyst frameworks? It seems the header translator doesn't find these which I suspect is probably because they are in a different location. Looks like they are inSystem/iOSSupport/System/Library/Frameworks versus System/Library/Frameworks.

Maybe some command line options could be added to control this?

silvanshade avatar Jan 28 '23 21:01 silvanshade

I also wonder if we may need to think of how to structure the modules differently to account for platform differences. For example, some of these frameworks are available for standard macOS development but also Catalyst. I'm not sure to what extent the header definitions are different but they are separate frameworks so that might be an issue.

silvanshade avatar Jan 28 '23 21:01 silvanshade

This is the real reason why header-translator is not just a fork of bindgen: It is because I was hoping we'd be able to take the list of Stmt's generated by the different platforms, and then combine them with cfg statements, such that we could expose a really nice docs.rs output with working "only available on target_os = macos" notes.

Not sure about catalyst yet.

madsmtm avatar Jan 29 '23 03:01 madsmtm

Hi, I'm interested in using the Vision api here. Could y'all point me to some resources on how I could get that ball rolling?

lachlansneff avatar May 21 '23 10:05 lachlansneff

The documentation for doing so is quite lacking, but the first steps for you would probably be taking a look at header-translator's readme, and then add the library to translation-config.toml and framework-includes.h.

Maybe you can also take some inspiration from the framework addition PRs that @silvanshade has contributed in the past.

Feel free to ask further questions, I'm also available on Matrix/Element as @madsmtm:matrix.org btw.

madsmtm avatar May 21 '23 12:05 madsmtm

UiKit support would be a dream come true ❤️

bes avatar Nov 21 '23 19:11 bes

Hey, I'm interested in adding support for ARKit. Are there any problems I'd need to anticipate, given it's iOS-only?

marcpabst avatar Feb 10 '24 11:02 marcpabst

Definitely problems, you can't do iOS-only frameworks yet, though I'm inching closer to it. Tentative timeline would be UIKit / support for other iOS frameworks around the start of March.

madsmtm avatar Feb 10 '24 12:02 madsmtm

Oh, that would be nice! I'm currently using a wacky apple-sys/objc implementation which feels a bit brittle and takes ages to compile.

marcpabst avatar Feb 10 '24 22:02 marcpabst

I hope there is some progress with CoreServices (Launch Services), too.

At the moment, I am using icrate's NSWorkspace to check and set the default browser, however this API is not available in older versions of MacOS. For now, my alternative is to add and use the core_foundation crate for any version less than 12.

  • setDefaultApplicationAtURL:toOpenURLsWithScheme:completionHandler (12+): https://developer.apple.com/documentation/appkit/nsworkspace/3753005-setdefaultapplicationaturl?language=objc
  • Deprecated LSSetDefaultHandlerForURLScheme (<12): https://developer.apple.com/documentation/coreservices/1447760-lssetdefaulthandlerforurlscheme?language=objc

A large chunk of MacOS users are still on <12 (if the statistics are correct) so hopefully this can be added up in the queue.

roniemartinez avatar Apr 06 '24 10:04 roniemartinez

Update on UIKit: I've put up https://github.com/madsmtm/objc2/pull/600, which I expect will be a bunch of trouble to get fully compiling, but mostly a bunch of tedious trouble, not a bunch of impossible-this-is-not-how-the-world-works trouble ;)

CC @simlay @jpedrick

madsmtm avatar Apr 17 '24 02:04 madsmtm

Apple provides a new framework called CompositorServices for immersive apps in visionOS. It would be great if we could have interface bindings for CompositorServices.

jinleili avatar Jun 27 '24 10:06 jinleili

Apple provides a new framework called CompositorServices for immersive apps in visionOS. It would be great if we could have interface bindings for CompositorServices.

Yeah, that'd indeed be nice. A bit difficult because it's only available on visionOS, so we'd have to do even further hacks to compile on that platform as well, but eh ;)

I won't have the time to do it myself for at least a few weeks, but you can try if you want? You'd probably have to edit around here to compile for visionOS, and then add the framework-crates/objc2-compositor-services/translation-config.toml to make header-translator compile it.

madsmtm avatar Jun 27 '24 22:06 madsmtm

I can give it a try this weekend.

jinleili avatar Jun 27 '24 22:06 jinleili

CoreServices would be great! I'd like to use Dictionary Services.

ijsnow avatar Aug 21 '24 02:08 ijsnow

CoreAudio please!

Brooooooklyn avatar Dec 12 '24 11:12 Brooooooklyn

Update: I managed to get a bare-bones CoreFoundation set up in #676, and have been slowly accumulating bindings to other frameworks like CoreGraphics, CoreText, CoreVideo, IOSurface etc. since then.

I won't guarantee anything in terms of CoreServices and CoreAudio yet though (especially because a lot of work is needed to actually make them nice to use), so in the meantime I'll link existing crates for these:

Not great if you're also using objc2, but there are ways to work around that.

madsmtm avatar Dec 12 '24 16:12 madsmtm

I added objc2-core-audio in 25bb2c7e75e8be8c132ca45536dcff89de0b5496, to be released soon. Tried to work a bit on CoreServices, but a lot more work is needed to map that.

madsmtm avatar Jan 12 '25 11:01 madsmtm

I need ExecutionPolicy.framework for EPDeveloperTool: https://developer.apple.com/documentation/executionpolicy/epdevelopertool?changes=_5&language=objc

The use case for this is ensuring the calling terminal has developer tool permissions.

lf- avatar Feb 12 '25 21:02 lf-

Added in 349dc408e4d0c81e01667cf62748da28c6f3f6d6, will be released in the next patch version (until then, you can temporarily copy the code to your app).

madsmtm avatar Feb 13 '25 16:02 madsmtm

I added CoreServices (without CarbonCore, but with Dictionary Services) in a5dc9d6e6c455977b8ae1ec7b247816dca6f1646, will be released in the above mentioned patch version.

madsmtm avatar Feb 25 '25 22:02 madsmtm

@madsmtm could we also possibly get https://developer.apple.com/documentation/safariservices?

Specifically, I currently need https://developer.apple.com/documentation/safariservices/sfsafariextensionmanager and https://developer.apple.com/documentation/safariservices/sfsafariapplication (showPreferencesForExtension).

dwosk avatar Feb 27 '25 06:02 dwosk

Already done in 5bcc1275e6160f53e78853a4184133479a1924ba, will be released in the same version as above.

madsmtm avatar Feb 27 '25 07:02 madsmtm

Have been hard at work the past few weeks, and I believe I've now mapped almost every useful framework, see the changelog for the full list (a notable exception is Network, tracked in #646).

Furthermore, I've added an overview of the crates we don't map in 330ffafd856bac804a60e4aa0eec5c21ccd05a0c, to make it clear why a framework isn't mapped (I haven't really been keeping this issue up to date), and to make sure that I get notified when a new framework is added in a new Xcode version.

So I'll close this issue now, and track missing frameworks in that file (or in separate, more tightly scoped issues), thanks for the input all!

(Again, all of this will be released in the next patch version).

madsmtm avatar Mar 18 '25 23:03 madsmtm