Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implementation of type safe signal wrapper functions #35

Closed
mikolasstuchlik opened this issue Oct 16, 2020 · 2 comments
Closed

Implementation of type safe signal wrapper functions #35

mikolasstuchlik opened this issue Oct 16, 2020 · 2 comments

Comments

@mikolasstuchlik
Copy link
Contributor

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.

@mikolasstuchlik
Copy link
Contributor Author

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.

@rhx
Copy link
Owner

rhx commented May 9, 2022

This has been merged into main now.

@rhx rhx closed this as completed May 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants