def is_dir(udid, remote_path, bundle_id):
        """
        Check if the specified path on the iOS device is a directory.

        Args:
            udid (str): The UDID of the iOS device.
            remote_path (str): The path on the iOS device.
            bundle_id (str): The bundle ID of the app.

        Returns:
            bool: True if the path is a directory, False otherwise.

        Examples:
            Check if the DCIM directory is a directory::

                >>> TIDevice.is_dir("00008020-001270842E88002E", "/DCIM")
                True

            Check if the Documents directory of the Keynote app is a directory::

                >>> TIDevice.is_dir("00008020-001270842E88002E", "/Documents", "com.apple.Keynote")
                True
                >>> TIDevice.is_dir("00008020-001270842E88002E", "/Documents/test.key", "com.apple.Keynote")
                False
        """
        try:
            remote_path = remote_path.rstrip("\\/")
            remote_path_dir, remote_path_base = os.path.split(remote_path)
            file_info = TIDevice.ls(udid, remote_path_dir, bundle_id)
            for info in file_info:
                # Remove the trailing slash.
                if info['name'].endswith("/"):
                    info['name'] = info['name'][:-1]
                if info['name'] == f"{remote_path_base}":
                    return info['type'] == 'Directory'
        except Exception as e:
            raise AirtestError(
                f"Failed to check if {remote_path} is a directory. Please check the path exist and try again.")

        Check if the specified path on the iOS device is a directory.

        Args:
            udid (str): The UDID of the iOS device.
            remote_path (str): The path on the iOS device.
            bundle_id (str): The bundle ID of the app.

        Returns:
            bool: True if the path is a directory, False otherwise.

        Examples:
            Check if the DCIM directory is a directory::

                >>> TIDevice.is_dir("00008020-001270842E88002E", "/DCIM")
                True

            Check if the Documents directory of the Keynote app is a directory::

                >>> TIDevice.is_dir("00008020-001270842E88002E", "/Documents", "com.apple.Keynote")
                True
                >>> TIDevice.is_dir("00008020-001270842E88002E", "/Documents/test.key", "com.apple.Keynote")
                False
        
airtest/core/ios/ios.py