Bear spray works by hopefully discharging enough of the active ingredient capsaicin into the mucous membranes of the offending critter causing it to rethink its attack. If for some reason a hog has more tolerance to pain than a Griz it may not work. On the other hand if you don't have an alternative than you don't have much to loose. Not making light of this, I would NOT want to tangle with a pig of any sort.

https://www.youtube.com/watch?v=nU5cMZymSr0

Keep in mind bear spray is not 100% effective on bears either. The linked video was an eye opener for me. If this bear was truly hit by the spray it certainly didn't have the effect I would be wanting to see, and backing up slowly and sticking around is not it.