Actions – Can Swarms / Troops in Pathfinder 1e cast spells and deal damage in the same turn?

I'm creating a troop of casters and I wanted to know if they could both do their "swarm damage" and cast a spell in the same turn.

It makes sense to me since an attack by a swarm says the following:

Creatures with the swarm subtype do not perform standard melee attacks. Instead, they deal automatic damage to any creature whose space they occupy at the end of their movement, without the need for an attack roll.

This means that they do not spend their standard Action to deal damage, it only happens because some of the creatures in the swarm bite / hit the target. That leaves other creatures available to do other things.

Am I missing a ruling against this?