Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion extension/apple/ExecuTorch/Exported/ExecuTorchValue.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ typedef float ExecuTorchFloatValue
*/
NS_SWIFT_NAME(Value)
__attribute__((deprecated("This API is experimental.")))
@interface ExecuTorchValue : NSObject
@interface ExecuTorchValue : NSObject <NSCopying>

/**
* The tag that indicates the dynamic type of the value.
Expand Down Expand Up @@ -208,6 +208,12 @@ __attribute__((deprecated("This API is experimental.")))
+ (instancetype)valueWithDouble:(ExecuTorchDoubleValue)value
NS_SWIFT_NAME(init(_:));

/**
* Returns a copy of the value.
*
* @return A new ExecuTorchValue instance that is a duplicate of the current value.
*/
- (instancetype)copy;

/**
* Determines whether the current Value is equal to another Value.
Expand Down
9 changes: 9 additions & 0 deletions extension/apple/ExecuTorch/Exported/ExecuTorchValue.mm
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,15 @@ - (instancetype)initWithTag:(ExecuTorchValueTag)tag
return self;
}

- (instancetype)copy {
return [self copyWithZone:nil];
}

- (instancetype)copyWithZone:(nullable NSZone *)zone {
return [[ExecuTorchValue allocWithZone:zone] initWithTag:_tag
value:[_value copyWithZone:zone]];
}

- (ExecuTorchValueTag)tag {
return _tag;
}
Expand Down
Loading