Update Swig to latest version

The swig definitions have been totally rewritten to the latest version
as of time of commit.

See: http://paularmstrong.github.io/swig/docs/api/ for how the API
should work.

I have also updated the tests to hopefully catch any obvious issues.
As it was basically a total rewrite I didn't know whether to include previous credits. Can I comma separate? Like: ```By: Peter Harris <url>, Carlos Ballesteros Velasco <url>```?