As the Smart Transactions feature is only available on Extension, you will not be able to cancel using the below method on MetaMask Mobile.
When you submit a swap, you'll be taken to a screen with a status bar, which indicates the progress of your transaction.
If you have enabled Smart Transactions, you can cancel any time before the transaction is confirmed by the network. You can enable Smart Transactions early in the swap process under 'Advanced Options':
When you have this setting on, you'll see the option to cancel your swap whilst it's yet to be confirmed:
Please note that you will not be able to cancel for free in all circumstances — this option is only available for a short window after you request the swap, whilst the Smart Transaction feature is at work and until the transaction is broadcast to the network. Although we’ll do our best to cancel for free when you request, we cannot guarantee it will be successful.
The cancellation button is dynamic, and once the free cancellation period is over, the text will automatically update to reflect the cost of cancelling the transaction at that time. So even if you miss this window, you can still cancel the transaction for a small gas fee.
Note: The cancellation fee is not charged by MetaMask
The fee shown on this screen to cancel your transaction is not a cost that MetaMask imposes on you. Rather, it's just the cost of gas to submit the cancellation transaction (similar to the cancellation process we outline here). The only fee MetaMask charges for the Swaps service is the 0.875% transaction fee that we list before you submit the swap.