diff --git a/mediapipe/tasks/ios/vision/core/sources/MPPRunningMode.h b/mediapipe/tasks/ios/vision/core/sources/MPPRunningMode.h index a3b3ad705..728ef2f48 100644 --- a/mediapipe/tasks/ios/vision/core/sources/MPPRunningMode.h +++ b/mediapipe/tasks/ios/vision/core/sources/MPPRunningMode.h @@ -39,16 +39,16 @@ typedef NS_ENUM(NSUInteger, MPPRunningMode) { } NS_SWIFT_NAME(RunningMode); NS_INLINE NSString *MPPRunningModeDisplayName(MPPRunningMode runningMode) { - if (runningMode > MPPRunningModeLiveStream) { - return nil; + switch (runningMode) { + case MPPRunningModeImage: + return @"Image"; + case MPPRunningModeVideo: + return @"Video"; + case MPPRunningModeLiveStream: + return @"Live Stream"; + default: + return nil; } - - NSString *displayNameMap[MPPRunningModeLiveStream + 1] = { - [MPPRunningModeImage] = @"Image", - [MPPRunningModeVideo] = @"Video", - [MPPRunningModeLiveStream] = @"Live Stream"}; - - return displayNameMap[runningMode]; } NS_ASSUME_NONNULL_END