Wrapped
The base class for all class bindings in Godot, you should not have to instantiate or subclass this class directly - there are better options in the hierarchy.
Wrapped.swift:76class Wrapped
Wrapped implements Equatable based on an identity based on the pointer to the Godot native object and also implements the Identifiable protocol using this pointer.
Wrapped subclasses come in two forms: straight bindings to the Godot API which are used to expose capabilities to developers. These objects, referred to as Framework types do not have any additional state associated in Swift, so they can be discarded or recreated as many times as it is needed.
When user subclass Wrapped, they might have state associated with them, so those objects are preserved and are not thrown away until they are explicitly relinquished by both Godot and any references you might hold to them. These are known as User types.
Any subclass ends up calling the Wrapped(StringName) constructor which provides the name of the most-derived framework type, and this constructor determines whether this is a Framework type or a user type.
To register User types with the framework make sure you call the register<T:Wrapped> (type: T.Type)
method like this:
register (type: MySpinningCube.self)
If you do not call this method, many of the overloads that Godot would call you back on will not be invoked.
Citizens in SwiftGodot
Conformances
protocol Equatable
A type that can be compared for value equality.
protocol Hashable
A type that can be hashed into a
Hasher
to produce an integer hash value.protocol Identifiable<ID>
A class of types whose instances hold the value of an entity with stable identity.
Type members
init(
) The constructor chain that uses StringName is internal, and is triggered when a class is initialized with the empty constructor - this means that subclasses will have a different name than the subclass.
init(nativeHandle: UnsafeRawPointer
) For use by the framework, you should not need to call this.
static var fcallbacks: OpaquePointer
static var ucallbacks: OpaquePointer
class var classInitializer: Void
class var godotClassName: StringName
class func implementedOverrides(
) -> [StringName] This method returns the list of StringNames for methods that the class overwrites, and is necessary to ensure that Godot knows which methods have been overwritten, and which ones Godot will provide a default behavior for.
static func == (lhs: Wrapped, rhs: Wrapped
) -> Bool
Instance members
var godotClassName: StringName
Returns the Godot’s class name as a
StringName
, returns the empty string on errorvar handle: UnsafeRawPointer?
Points to the underlying object
var id: Int
Conformance to Identifiable by using the native handle to the object
var isValid: Bool
This property indicates if the instance is valid or not.
func hash(into: inout Hasher
)
Type features
static func != (lhs: Self, rhs: Self
) -> Bool Returns a Boolean value indicating whether two values are not equal.
Subclasses
class Object
Base class for all other classes in the engine.