-
Notifications
You must be signed in to change notification settings - Fork 204
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[SwiftBindings] Made AnyType compatible with ISwiftObject #2909
base: feature/swift-bindings
Are you sure you want to change the base?
Conversation
var metadata = SwiftObjectHelper<AnyType>.GetTypeMetadata(); | ||
if (!metadata.IsValid) | ||
{ | ||
throw new InvalidOperationException("Cannot marshal AnyType to Swift without metadata"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should these strings be localized?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe. I put the exceptions in as an afterthought since it looks like this is not an actual valid type because of the lack of a valid TypeMetadata. @kotlarmilos - is AnyType
a placeholder for the future since it isn't valid?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes -- it is safe to assume the type is not valid.
var metadata = SwiftObjectHelper<AnyType>.GetTypeMetadata(); | ||
if (!metadata.IsValid) | ||
{ | ||
throw new InvalidOperationException("Cannot marshal AnyType to Swift without metadata"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes -- it is safe to assume the type is not valid.
This change breaks the compilation: The type or namespace name 'MetadataRequest' could not be found. |
Moved
SwiftOptional<T>
to theSwift
namespace.Updated the
AnyType
class to be compatible with theISwiftObject
interface.This change adds the methods
NewFromPayload
andMarshalToSwift
toAnyObject
.Since the default implementation of GetTypeMetadata returns an invalid metadata, the
MarshalToSwift
method throws an exception.Since the default implementation has a payload of
SwiftHandle.Zero
, MarshalToSwift throws an exception.