@@ -22,6 +22,16 @@ typedef NS_ENUM(NSInteger, ExecuTorchModuleLoadMode) {
2222 ExecuTorchModuleLoadModeMmapUseMlockIgnoreErrors,
2323} NS_SWIFT_NAME(ModuleLoadMode);
2424
25+ /* *
26+ * Enum to define the verification level used when loading a module.
27+ * Values can be a subset, but must numerically match exactly those defined in
28+ * runtime/executor/program.h
29+ */
30+ typedef NS_ENUM (uint8_t , ExecuTorchVerification) {
31+ ExecuTorchVerificationMinimal,
32+ ExecuTorchVerificationInternalConsistency,
33+ } NS_SWIFT_NAME(ModuleVerification);
34+
2535/* *
2636 * Represents a module that encapsulates an ExecuTorch program.
2737 * This class is a facade for loading programs and executing methods within them.
@@ -49,6 +59,33 @@ __attribute__((deprecated("This API is experimental.")))
4959 */
5060- (instancetype )initWithFilePath:(NSString *)filePath;
5161
62+ /* *
63+ * Loads the module’s program using the specified verification level.
64+ *
65+ * @param verification The verification level to apply when loading the program.
66+ * @param error A pointer to an NSError pointer that will be set if an error occurs.
67+ * @return YES if the program was successfully loaded; otherwise, NO.
68+ */
69+ - (BOOL )loadWithVerification:(ExecuTorchVerification)verification
70+ error:(NSError **)error;
71+
72+ /* *
73+ * Loads the module’s program using minimal verification.
74+ *
75+ * This is a convenience overload that defaults the verification level to Minimal.
76+ *
77+ * @param error A pointer to an NSError pointer that will be set if an error occurs.
78+ * @return YES if the program was successfully loaded; otherwise, NO.
79+ */
80+ - (BOOL )load:(NSError **)error;
81+
82+ /* *
83+ * Checks if the module is loaded.
84+ *
85+ * @return YES if the module's program is loaded; otherwise, NO.
86+ */
87+ - (BOOL )isLoaded;
88+
5289+ (instancetype )new NS_UNAVAILABLE;
5390- (instancetype )init NS_UNAVAILABLE;
5491
0 commit comments