Implementation of type safe signal wrapper functions
mikolasstuchlik opened this issue · 2 comments
There is an ongoing effort to implement type safe wrappers around signals. The implementation is in its early stages. Once the implementation will produce functional code, PRs will be opened at related repositories.
The PR to gir2swift can be found here at the moment.
Any suggestion or advice is welcomed.
I would like to provide status update of the ongoing effort into providing type-safe signal generation.
There is a PR opened inside of my fork of the gir2swift repository. The requires modified implementation of GLib and SwiftGtk due to name conflicts.
The current implementation in the time of writing is able to generate most of the required signals and appropriate strings for those, which could not be generated.
The gir2swift project was somewhat refactored (files were renamed and splitted) because my mac had a hard time keeping the IDE interactive and doing so greatly improved my computers ability to keep the xcode interactive.
What IS implemented
- Generate documentation for each signal with labels for arguments
- Generate correct register function call for each generated signal
- Generate handler with strictly Swift arguments (for example UInt, Int, String)
- Generate ownership transfer for string return values only
- Generate property notify signals too
- Support for optional arguments
The implementation is able to generated most of the signals. There are still 9 different checks which prohibit signal generation because it would require unimplemented features. Those unimplemented features consists mainly of:
- Ownership transfer and inout arguments
- Arrays are not supported neither as an argument or return type
- Record types can not be return type (due to lack of ownership transfer)
I will publish a demo project in the near future.
I plan on merging my forks into main repositories, but at this time, my main focus is to have working implementation for Swift 5.3 @ Ubuntu 20.04.
This has been merged into main now.