Swords were never the weapon of choice in medieval Europe. There was never a singular weapon that was preferred in every circumstance. At various times and places, medieval soldiers fought with lances, hammers, axes, polearms, maces, clubs, straight swords, curved swords, daggers, bows, crossbows, handguns, and even rocks and sticks they picked up off the ground. Talking about "primary" weapons doesn't really make sense in the context of the era, a period where warriors readily switched between their various options according to the situation. However, swords were popular because they were easy to carry in a sheath, relatively light, and useful in a variety of circumstances. You can use one to cut, to thrust, or to defend yourself from an oncoming blow. Unlike a poleaxe or a pike, you can easily carry a sword while traveling even outside of a military context, which adds a certain degree of utility when going about your daily business.