A reading of the stat blocks for swarms suggests to me that they can be targeted by weapons, since they have resistance to bludgeoning, piercing, and slashing. But they're also immune to targeted effects, and the swarm description states, "Swarms are immune to any effects that target a specific creatures [sic] or a specific number of creatures."
Technically, an attack targets a specific creature. So can my warhammer-wielding dwarf go to town on a spider swarm or is she out of luck like in 1st edition?