Removed convenience initializer in MPPClassificationResult

This commit is contained in:
Prianka Liz Kariat 2023-01-06 13:47:33 +05:30
parent d804506799
commit 8570136f80
3 changed files with 4 additions and 24 deletions

View File

@ -89,18 +89,6 @@ NS_SWIFT_NAME(ClassificationResult)
**/
@property(nonatomic, readonly) NSInteger timestampMs;
/**
* Initializes a new `MPPClassificationResult` with the given array of classifications. This method
* must be used when no time stamp needs to be specified. It sets the property `timestampMs` to -1.
*
* @param classifications An Aaray of `MPPClassifications` objects containing classifier
* predictions per classifier head.
*
* @return An instance of MPPClassificationResult initialized with the given array of
* classifications.
**/
- (instancetype)initWithClassifications:(NSArray<MPPClassifications *> *)classifications;
/**
* Initializes a new `MPPClassificationResult` with the given array of classifications and time
* stamp (in milliseconds).

View File

@ -48,10 +48,4 @@
return self;
}
- (instancetype)initWithClassifications:(NSArray<MPPClassifications *> *)classifications {
return [self initWithClassifications:classifications timestampMs:-1];
return self;
}
@end

View File

@ -54,15 +54,13 @@ using ClassificationResultProto =
}
MPPClassificationResult *classificationResult;
NSInteger timeStampMs;
if (classificationResultProto.has_timestamp_ms()) {
classificationResult = [[MPPClassificationResult alloc] initWithClassifications:classifications timestampMs:(NSInteger)classificationResultProto.timestamp_ms()];
timeStampMs = (NSInteger)classificationResultProto.timestamp_ms();
}
else {
classificationResult = [[MPPClassificationResult alloc] initWithClassifications:classifications];
}
return classificationResult;
return [[MPPClassificationResult alloc] initWithClassifications:classifications timestampMs:timeStampMs];;
}
@end