Skip to content

Convenience wrapper around g_object_new #3

@QuLogic

Description

@QuLogic

Looking at the docs for GObject, it appears that all init are simple wrappers around the C constructors, except for its most convenient one, the variadic g_object_new function. The closest match seems to be GLibObject.Object.new, which takes a GType, but unfortunately no property arguments. The remaining init all appear to take UnsafeMutablePointer to C strings or GValue which are pretty inconvenient to use from Swift.

Python solves this by taking keyword arguments and passing those as the properties. I don't think that that would be possible in Swift's form of variadic arguments.

Lua solves this by taking a table as first argument with property name/values. I guess that might work for Swift by taking a [String: Any].

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions