Swarm guns were used by Swarm soldiers during the Battle of Altamid, as they were invading the USS Enterprise. At one stage in that battle, in the starship's manual release room, Uhura managed to wrestle a Swarm gun from out of the hold of a Swarm drone in order to fire it at another of the Swarm troops.
Later, when a Swarm ship which had been commandeered by Spock and Doctor Leonard McCoy crash landed on the surface of the planet Altamid, a Swarm gun from the ship ended up in a pool of murky water, directly beside the downed craft. After cracking the front of the weapon open with a ripped-off and sharp-edged component from the Swarm ship, McCoy fired the weapon at the component, superheating it. He then used the red-hot component to cauterize a wound Spock had, to prevent or lessen it bleeding. (Star Trek Beyond)