ObjectRef
public struct ObjectRef : ObjectProtocol, GWeakCapturing
The base object type.
All the fields in the GObject
structure are private to the implementation
and should never be accessed directly.
The ObjectRef
type acts as a lightweight Swift reference to an underlying GObject
instance.
It exposes methods that can operate on this data type through ObjectProtocol
conformance.
Use ObjectRef
only as an unowned
reference to an existing GObject
instance.
-
Untyped pointer to the underlying `GObject` instance.
For type-safe access, use the generated, typed pointer
object_ptr
property instead.Declaration
Swift
public let ptr: UnsafeMutableRawPointer!
-
Designated initialiser from the underlying
C
data typeDeclaration
Swift
@inlinable init(_ p: UnsafeMutablePointer<GObject>)
-
Designated initialiser from a constant pointer to the underlying
C
data typeDeclaration
Swift
@inlinable init(_ p: UnsafePointer<GObject>)
-
Conditional initialiser from an optional pointer to the underlying
C
data typeDeclaration
Swift
@inlinable init!(_ maybePointer: UnsafeMutablePointer<GObject>?)
-
Conditional initialiser from an optional, non-mutable pointer to the underlying
C
data typeDeclaration
Swift
@inlinable init!(_ maybePointer: UnsafePointer<GObject>?)
-
Conditional initialiser from an optional
gpointer
Declaration
Swift
@inlinable init!(gpointer g: gpointer?)
-
Conditional initialiser from an optional, non-mutable
gconstpointer
Declaration
Swift
@inlinable init!(gconstpointer g: gconstpointer?)
-
Reference intialiser for a related type that implements
ObjectProtocol
Declaration
Swift
@inlinable init<T>(_ other: T) where T : ObjectProtocol
-
This factory is syntactic sugar for setting weak pointers wrapped in
GWeak<T>
Declaration
Swift
@inlinable static func unowned<T>(_ other: T) -> ObjectRef where T : ObjectProtocol
-
Unsafe typed initialiser. Do not use unless you know the underlying data type the pointer points to conforms to
ObjectProtocol
.Declaration
Swift
@inlinable init<T>(cPointer: UnsafeMutablePointer<T>)
-
Unsafe typed initialiser. Do not use unless you know the underlying data type the pointer points to conforms to
ObjectProtocol
.Declaration
Swift
@inlinable init<T>(constPointer: UnsafePointer<T>)
-
Unsafe untyped initialiser. Do not use unless you know the underlying data type the pointer points to conforms to
ObjectProtocol
.Declaration
Swift
@inlinable init(mutating raw: UnsafeRawPointer)
-
Unsafe untyped initialiser. Do not use unless you know the underlying data type the pointer points to conforms to
ObjectProtocol
.Declaration
Swift
@inlinable init(raw: UnsafeMutableRawPointer)
-
Unsafe untyped initialiser. Do not use unless you know the underlying data type the pointer points to conforms to
ObjectProtocol
.Declaration
Swift
@inlinable init(opaquePointer: OpaquePointer)
-
Creates a new instance of a
GObject
subtype and sets its properties.Construction parameters (see
G_PARAM_CONSTRUCT
,G_PARAM_CONSTRUCT_ONLY
) which are not explicitly specified are set to their default values.Declaration
Swift
@inlinable init(valist objectType: GType, firstPropertyName: UnsafePointer<gchar>!, varArgs: CVaListPointer)
-
Creates a new instance of a
GObject
subtype and sets its properties using the provided arrays. Both arrays must have exactlyn_properties
elements, and the names and values correspond by index.Construction parameters (see
G_PARAM_CONSTRUCT
,G_PARAM_CONSTRUCT_ONLY
) which are not explicitly specified are set to their default values.Declaration
Swift
@inlinable init(properties objectType: GType, nProperties: Int, names: UnsafeMutablePointer<UnsafePointer<CChar>?>!, values: UnsafePointer<GValue>!)
-
Creates a new instance of a
GObject
subtype and sets its properties.Construction parameters (see
G_PARAM_CONSTRUCT
,G_PARAM_CONSTRUCT_ONLY
) which are not explicitly specified are set to their default values.newv is deprecated: Use g_object_new_with_properties() instead. deprecated. See #GParameter for more information.
Declaration
Swift
@available(*, deprecated) @inlinable init(objectType: GType, nParameters: Int, parameters: UnsafeMutablePointer<GParameter>!)
-
Creates a new instance of a
GObject
subtype and sets its properties.Construction parameters (see
G_PARAM_CONSTRUCT
,G_PARAM_CONSTRUCT_ONLY
) which are not explicitly specified are set to their default values.Declaration
Swift
@inlinable static func new(valist objectType: GType, firstPropertyName: UnsafePointer<gchar>!, varArgs: CVaListPointer) -> GLibObject.ObjectRef!
-
Creates a new instance of a
GObject
subtype and sets its properties using the provided arrays. Both arrays must have exactlyn_properties
elements, and the names and values correspond by index.Construction parameters (see
G_PARAM_CONSTRUCT
,G_PARAM_CONSTRUCT_ONLY
) which are not explicitly specified are set to their default values.Declaration
Swift
@inlinable static func newWith(properties objectType: GType, nProperties: Int, names: UnsafeMutablePointer<UnsafePointer<CChar>?>!, values: UnsafePointer<GValue>!) -> GLibObject.ObjectRef!
-
Creates a new instance of a
GObject
subtype and sets its properties.Construction parameters (see
G_PARAM_CONSTRUCT
,G_PARAM_CONSTRUCT_ONLY
) which are not explicitly specified are set to their default values.newv is deprecated: Use g_object_new_with_properties() instead. deprecated. See #GParameter for more information.
Declaration
Swift
@available(*, deprecated) @inlinable static func newv(objectType: GType, nParameters: Int, parameters: UnsafeMutablePointer<GParameter>!) -> GLibObject.ObjectRef!