I take it from the perspective of logistical upkeep. A modern weapon has a lot of tiny springs and mechanisms that must, eventually, be replaced. And modern ammunition using smokeless powder (which is comparatively hard to refine to say, black powder) takes a lot of logistical legwork to get all the materials in one place.
In an apocalypse scenario, modern weapons would quickly deteriorate due to their exposure to the elements. One spring rusting beyond use turns an AR-15 into a bolt action rifle, effectively, and at worst disables the weapon entirely. Since replacement parts are an issue, that means either you’ll have to work with less weapons or swap to an alternative that is easier to manufacture; black powder and revolvers.
Revolvers don’t jam as often as modern weapons, but it’s a widespread misconception that they never jam. A revolver has many issues a modern weapon doesn’t have such as the cylinder coming out of timing which disables the weapon entirely. Both must contend with dud rounds though in the case of the revolver it’s as simple as pulling the trigger again.
If we swap to a revolver, which takes a long time to reload by comparison to a modern weapon, you may not have enough time to reload. Swapping to another weapon (another revolver, in this example) may be an alternative… but a sword doesn’t jam. In the confines of a building with limited ammunition, a sword may be the best alternative. Or a bayonet.
It’s certainly a niche weapon, but all weapons are technically niche. You can’t use an AR-15 to hit someone two miles away, though its niche is certainly much broader than something like a .50 cal sniper. Likewise, you’re certainly not charging across open field with a sword to stab the guy with an automatic weapon, but from horseback (because something has to replace the car and gasoline is no longer useful past roughly 90 days) the sword becomes more useful if you cannot, for whatever reason, use a firearm.
The obvious counter to this is using improvised clubs, but anyone can use a cudgel. Swords take skill and a good situation. Up close and personal, a moderately skilled swordsman will likely win against even an experienced rifleman simply because he has more options.