def build(
        cls,
        device: Device,
        build_directory: _Path,
        credentials: AppSigningCredentials,
        clean: bool = False,
    ) -> _Path:
        """
        Build the ``modelrunner`` Xcode project for the specified device.

        This method handles the entire build process, including cleaning if requested,
        setting up the build directory, and running the ``xcodebuild`` command.

        Parameters:
        -----------
        device: Device
            The target device for which to build the app.

        build_directory: Path
            The directory where build artifacts will be stored.

        clean: bool
            Whether to clean the build directory before building (default is False).

        Returns
        -------
        Path
            The path to the built .app file if successful, None otherwise.

        """

        def command_exists(command):
            """Check if a command exists in the system's PATH."""
            return _shutil.which(command) is not None

        project_path = _ModelRunnerAppBuilder._get_project_path()

        if not project_path.is_dir():
            raise ValueError(
                f"Model runner directory not found at expected path: {project_path.resolve()}"
            )

        workspace_path = project_path / "ModelRunner.xcworkspace"

        if not workspace_path.is_dir():
            raise ValueError(
                f"Workspace directory not found at expected path: {workspace_path.resolve()}"
            )

        if not command_exists("xcodebuild"):
            raise ValueError(
                "The 'xcodebuild' command is required. Please ensure that Xcode Command Line Tools are installed and accessible."
            )

        return super().build(
            device=device,
            build_directory=build_directory.resolve(),
            workspace_path=workspace_path.resolve(),
            credentials=credentials,
            clean=clean,
        )

        Build the ``modelrunner`` Xcode project for the specified device.

        This method handles the entire build process, including cleaning if requested,
        setting up the build directory, and running the ``xcodebuild`` command.

        Parameters:
        -----------
        device: Device
            The target device for which to build the app.

        build_directory: Path
            The directory where build artifacts will be stored.

        clean: bool
            Whether to clean the build directory before building (default is False).

        Returns
        -------
        Path
            The path to the built .app file if successful, None otherwise.

        
coremltools/models/ml_program/experimental/remote_device.py