Documentation Language: Swift

Structure

TypeReference

Reference to a GIR type.

struct TypeReference

Topics

Initializers

?
init(type:in:identifier:isConst:isOptional:isArray:constPointers:)

Designated initialiser for a type reference

Instance Properties

V
constPointers

Array of pointers (true if they are const, false if they are mutable)

V
forceUnwrappedName

returns the force-unwrapped, full type name

V
fullCType

returns the full C type including pointers and const

V
fullSwiftTypeName

returns the full Swift type (e.g. class) including pointers and taking into account const

V
fullTypeName

returns the full type including pointers and taking into account const

V
fullUnderlyingCName

returns the full C type including pointers and taking into account const

V
identifier

The identifier of this instance

V
idiomaticType

Return the idiomatic Swift type for a given type reference

V
indirectionLevel

The level of indirection, with 0 indicating the referenced type itself, 1 representing a pointer to an instance of the referenced type, 2 representing an array of pointers (or a pointer to a pointer), etc.

V
isArray

Whether or not the referenced type is an array

V
isConst

Whether or not the referenced type is const

V
isOptional

Whether or not the referenced type is optional (nullable)

V
isVoid

Returns true if the receiver is a reference to void

V
knownIndirectionLevel

The level of indirection, taking into account known types such as gpointer with 0 indicating the referenced type itself, 1 representing a pointer to an instance of the referenced type, 2 representing an array of pointers (or a pointer to a pointer), etc.

V
knownPointerOffset

Return an indirectionLevel offset if the type in question is a known pointer

V
namespace

The namespace for this instance

V
type

The type referenced

V
underlyingType

Return the underlying type (e.g. class or primitive C type) for a given type reference

Instance Methods

F
cast(expression:from:)

Cast from one type reference to another

F
embeddedType(named:)

Embed the given type in a layer of pointers as appropriate

F
fullUnderlyingTypeName(asOptional:)

Returns the full type including pointers and taking into account const

F
isAlias(of:)

Test whether the receiver is an alias of the given type

F
isAlias(of:)

Test whether the receiver is an alias of the given type reference

F
isDirectPointer(to:)

Test whether the receiver is a direct pointer to the given type reference

F
isDirectPointer(to:)

Test whether the receiver is a direct pointer to the given type

F
isSomePointer(to:)

Test whether the receiver is a pointer at some level to the given type

F
isSomePointer(to:)

Test whether the receiver is a pointer at some level to the given type reference

F
references(_:)

Test whether the receiver references the given type

F
references(_:)

Test whether the receiver references the given type reference

Type Properties

?
void

Reference to void type

Type Methods

?
pointer(to:in:isConst:pointerIsConst:)

Create a single-indirection pointer to a given target

Default Implementations

Relationships

Conforms To

See Also

Type system

C
GIRType

Representation of a fundamental type, its relationship to other types, and casting operations

C
GIRStringType

Representation of a string type, its relationship to other types, and casting operations

C
GIRRawPointerType

Representation of a raw pointer type, its relationship to other types, and casting operations

C
GIRRecordType

Representation of a record type (struct or class), its relationship to other types, and casting operations

C
GIRGenericType

Representation of a generic type (struct or class), its relationship to other types, and casting operations

C
GIROpaquePointerType

Representation of a opaque pointer type, its relationship to other types, and casting operations

C
TypeConversion

Type conversion operation. This root class is used for aliases/equal type conversions, i.e., casts are no-ops.

C
SubClassConversion

Parent/Child class conversion operation

C
OptionalSubClassConversion

Parent/Child class conversion operation with optional upcast

C
CustomConversion

Custom type conversion operation

C
NestedConversion

Nested type conversion operation

C
EnumTypeConversion

Enum type conversion operation.

C
BitfieldTypeConversion

Bit field (OptionSet) type conversion operation.