Delete a Row

Catalyst iOS SDK enables you to delete a single row from a specific Data Store table. However, you will not be able to delete multiple rows at a time.

You can delete a row from a table in any of these two methods:

Delete a Row by passing the Row ID to the Table Instance

You can delete a row from a table by passing the ROWID of the row as the argument to the deleteRow() method, as shown in the code syntax below.

The <DATA_STORE_INSTANCE> used in the code syntax below is the instance defined in the Data Store Instance page.

copy
<DATA_STORE_INSTANCE>.deleteRow( id : Int64, completion : @escaping( ZCatalystError? ) -> Void )

Parameters:

  • id: The unique ROWID of the row to be deleted.
  • completion: If the operation is successful, the completion block will return the details of the deleted row. Else, it will return an error.

A sample code snippet is shown below:

copy
ZCatalystApp.shared.getDataStoreInstance(tableIdentifier: "1096000000002071").deleteRow(id: 3376000000171021){( error ) in
//Replace this with your ROWID
if let error = error{
  	print( "Error occurred >>> \( error )" )
 	}
	else {
	  print("Row is successfully deleted.")
	 }
}

Delete a Row by passing the Row Instance

You can delete a row from a table simply by calling the delete() method for the row instance.

The <ROW_INSTANCE> used in the code syntax below is the instance defined in the Row Instance page.

copy
<ROW_INSTANCE>.delete(completion: @escaping( ZCatalystError? ) -> Void)

Parameters:

  • completion: If the operation is successful, the completion block will return the details of the deleted rows. Else, it will return an error.

A sample code snippet is shown below:

copy

ZCatalystApp.shared.getDataStoreInstance().getTableInstance(id: 1096000000002071).getRow(id: 3376000000171021){(result)in
//Replace this with your ROWID
	switch result	{
	  case .success ( let row) :
	   row.delete() {( error ) in
    	if let error = error{
	     print( "Error occurred >>> \( error )" )
    	}
    	else {
	     print("Row is successfully deleted.")
   	}
	  }
  	case .error(let error) :
	   print("Error occurred >>> \( error )")
 	}
}

Last Updated 2025-08-28 12:01:44 +0530 IST