For SWIM debugging no, you need to continuously keep communicating to the device so you can not configure it during debugging as a hard output for instance.
For final product, it also is kinda tricky so I never do this but it should be possible.
The problem I encountered in the past was that the SWIM signal is high frequency (order of 10MHz) so for instance a small capacitance on that pin can already inhibit the use of SWIM programming/debugging.
So my advice is to breadboard your design first and do a lot of testing before putting it in a real product. For hobby purposes you can always make a jumper or small switch.