Important: changes to SwiftGodot's Variant handling. #609
migueldeicaza
announced in
Announcements
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
@elijah-semyonov Did a major rework of the engine in SwiftGodot to sanitize the use of Variants in the codebase.
Variants in Godot are peculiar because in Godot, they can be "nil" and you must probe whether a variant is nil or not explicitly. Because we have Variants to classes in SwiftGodot, we had two sets of tests, one whether an Optional was nil or not, and then whether the contained value was Godot-nil or not.
And some places had nil and others did not, but it was not ideal.
This refactoring makes it so we "Variant?" to users, where nil means "This is nil in Swift, and nil in Godot", so you will never have to test for Godot's nil and if it is not nil, it will always be a non-Godot-nil Variant.
I will let this patch simmer for a few days before making an official release, and give folks a chance to comment on the API changes and whether there are improvements that are necessary.
I migrated my Xogot codebase and it did spot a few bugs, so I am glad that I did this and the changes were pretty mild.
Beta Was this translation helpful? Give feedback.
All reactions