There are various methods to prevent swarming, none of them are guaranteed failsafe.
Swarm prevention methods do in fact only postpone the time of swarming and have to be repeated until that time when it is too late in the season for swarms. When not repeated often enough swarming does eventually happen. (Not to swarm is against nature)
Swarm prevention methods are based on:
Weakening the colony – creating colony splits.
Encouraging population growth – replacing honey frames with foundation.
Encouraging growth – stacking on a super with foundation.
Changing the objective – rearranging brood frames, build a pyramid.
Note: When trying to explain how bees “think & work” it helps to assume they have a one-track mind – once they are on that track, nothing will stop them. To prevent swarming is by changing their priority, engage them in other activities again and again, until it is too late in the season to swarm.