1. having spent the night in the water为现在分词短语做时间状语。
翻译为:在水里呆了一夜之后,她游向岸边/海滨。
2. having spent the night in the water其实是现在分词短语的完成形式,其一般式是spending the night in the water。
因为句子主语(即spend的逻辑主语)和非谓语动词spend之间为主动关系,所以用其现在分词形式。
又因为spend the night...该动作发生在谓语动词swam to the shore之前,所以进一步使用现在分词的完成形式having spent...
参考资料:英语牛人团