I tend to prefer swapfiles.
Doesn't require a partition, so it can be resized easily and won't require you to know the partition number. (Opinion: fewer partitions is just easier)
It is encrypted swap when on a fully encrypted drive without needing more partitioning work.

I don't actually know a reason to make swap a partition over a swapfile. I imagine there is a partition setting somehow or maybe the inability to resize is desirable, but that hasn't been my use case before.

To be fair though... I don't use hibernate so don't really need a swap either. So it is rare I'd need it anyway.
------------------------------
Message: 2
Date: Mon, 26 Oct 2020 21:22:57 -0700
From: Jim <azanorak@gmail.com>
To: plug-discuss@lists.phxlinux.org
Subject: swap file vs swap partition
Message-ID: <4613ab4d-61b5-34b0-4944-d0917cec234e@gmail.com>
Content-Type: text/plain; charset=utf-8; format=flowed
Regarding swap file vs swap partition: Is one better than the other? 
When I installed Kubuntu on my machine, both options were available and
I chose the swap file.  The OS is installed on an SSD