[WIP] Swift unit tests

_Depends on #1406._

Unit tests for #1382.