Minecraft swords become ... to break in the middle of a battle. That is why Mending is a perfect enchantment. It uses the experience points (XP) to repair the sword, which lasts indefinitely.