V2.0 swift feature branch for merge into v2.0

Warning: needs tests!