I grew up on a small family farm in Oklahoma. We raised a variety of animals that we took to market including hogs. Not that they all have the same characteristics (in other words, don't judge a pig by his snout), as these wild ones, but in general they are very sweet animals. They are smart as all get out and they don't forget a thing. I think they are more easily trained than dogs (cats would agree).
What I didn't like about them, is that their mission in life, was to bust out of the fence either rooting under it, or in some cases going right through. There were countless times I'd be on the school bus heading home, and as we approached our farm, I'd see pigs gone wild all over the place. They'd be out rooting away and the piglets would jump around and play, just like kittens and puppies. Guess what they'd do when I or my brother showed up? They'd know the gig (not pig), was up, and they'd start walking back to where they were supposed to be.
The problem with them, thus a problem for us now, is that their skin is extremely tough, and you can pretty much kick them in the snout or anywhere else, and they hardly feel it. So, for these wild ones around here, it's difficult to stop them because they just don't feel the blows.
What I'd recommend is having a Hike and Strike Walking Stick from Northern Tool (which is awesome protection from all wild creatures), because hogs hate Thomas Edison. A quick jolt and it normally stops them in their tracks. Whether it's a hog attacking your dog or another dog, you wouldn't need to get close to the violence and possibly get hurt yourself.
I don't recommend using any type of pepper spray because what you don't want is a pig that strong not being able to see and running wild in your back yard. You would need a serious fence repair. Sorry for the long post, but I'm bored to tears this morning. Let me know if you want to know the coup, whoops, I mean scoop, on chickens. 😁