I’ve been making some progress in incorporating SDL into my Swift app, but I want to make it better. One of the problems is that SDL defines a lot of constants with macros, and those don’t import nicely. It also uses opaque pointer types (e.g.
typedef struct SDL_Window SDL_Window), which import as
Do I need to create an entire parallel class hierarchy, wrapping each of the SDL types (e.g.
SDL_Window), or can I use API Notes to express these types more Swiftily, and add extensions where it’s useful?
SDL_Window has a bunch of methods like
SDL_CreateWindow() takes a few parameters, one that is best expressed as an
Even getting API Notes to work is confusing. I tried putting
ClibSDL2.apinotes in next to the
.modulemap file, with the following contents:
Classes: - Name: SDL_Window SwiftName: SDLWindow Functions: - Name: SDL_CreateWindow SwiftName: 'SDLWindow.init(title:x:y:width:height:flags:)
SDLWindow is still unknown to Swift. Do API Notes files work with
Thanks for any and all suggestions.