Pigs can be kept quite easily on just electric but a few caveats
1. They must be trained first
2. Whilst sows will generally stay behind a single strand, and we've brought lots of weaners to fattening weight on the same method, youngsters do tend to push each other and run around, and can run or be pushed through an electric fence, and escape that way.
3. Again whilst for sows some of our fences may not actually be on for months and they will stay behind it quite happily, youngsters will tend to test more, so make sure it's working.
4. We like tape - pigs see it easily and learn that it is the white stuff that you avoid.
5. I would not keep a mature boar just behind eclectic
6. If a sow on heat can smell a boar, love is a powerful thing, and more powerful than an electric fence - keep boars out of scent distance
7. Don't rely on just the fence to protect. We use electric to create areas within our fields. If the pigs do escape they have a large field to explore that is stock fenced, so I will find them long before they have found their way out of the field. Don't put your pigs just behind electric if they can access anything that's not yours if they get out - eg road, next doors prize veg patch, or anything you want to protect - eg your prize veg patch
8. Lop eared pigs are generally easier behind electric than pricked eared
9. As Andrew says pigs don't like crossing any boundary, and it can be hard to get them out from where the electric was - some come easily others don't
10. Final point - There is always the exception to the rule - the pig that sees electric as a challenge - our was called Annabel - a middlewhite that would trail electric fence wire behind her as she wandered up the field to greet us !
So generally - electric fencing offers a convenient, moveable, cheap fencing arrangement, but in its place !