Well, Swords are as big as assault rifles, and take a while (and a lot of space) to draw, especially if you've got something in your hands already.
Nope. Not every sword is a freaking zweihander. For secondary weapon, we're probably talking something along the lines of a gladius, or arming sword equivalent.
On length dimension maybye the size of a compact carabine, but in terms of bulk, other dimension, and general mass, considerably smaller.
The same applies to drawing it and reloading a gun.
And even if drawing a new full length weapon is faster, considering you have to draw the sword, you could just as easily have another loaded gun, and bring it to bear in comparable time. An M4 carbine (rather beefy as a backup) only weighs seven or eight pounds loaded? Even a Saber is going to be four or five pounds at least considering belt and scabbard, and may very well be longer.
Handgun, machine pistol, or PDW, yes. But those also run out of ammo, may lack firepower, and those who do have it run out of ammo very quickly.
A carabine, you can't really put that in a hip holster or something like that, so that's a whole another level of trouble when it comes to storage and quick access.
Also weight wise, for comparison a gladius generally weights less than 2 pounds.
Then it comes down to opponent's nature, tactics and circumstances. A handgun or PDW as a secondary lets you unload lots of pistol to near intermediate (in heavier PDW's) rounds into an opponent. What's that worth? Depends on circumstances and the opponent. If you're fighting say, Tyranid rippers, that may not be great - you got a few down, few wounded, and the rest shred you to bits while you try to reload.
A sword opens up some other opportunities. You can fend off opponents with it, keep them at a distance, and strike indefinitely, and use it for protection while at it, at least until you get too tired.
OTOH with some melee opponents that will generally crash through a a mediocre swordsman on sheer size, reach or speed, or for other reasons may be hard to fight with a melee weapon, a PDW may be a better idea, like, say, with a xenomorph.