Triarii definitely switch between sword and spear. I'm finding them a little hard to use (the early phalanx ones) because sometimes cavalry get among them, causing them to draw swords and cut them up. They seem to do best against enemy heavy infantry. Principes seem more robust against cavalry - they have no phalanx formation that can be disrupted - perhaps because they don't seem to automatically draw swords?