Backport improved Swift header support

Backport of #107 to 1.7.x