Electric fencing for pigs
Pigs can be trickier to contain because they’re intelligent beasts that will root and dig, so you need a robust pen to reduce the possibility of escapees.
Electric fencing is an excellent, safe solution. Training when they are weaners will teach them to respect the fence and recognise that they need to avoid it. Two strands should be sufficient to contain most breeds with the correct voltage.
More info