Barn swallows do not nest in boxes or birdhouses. They build their nests of mud and grass on the sides of beams, usually in a barn. My suggestion is that you attach a skirt of wood, say a 2 x 6 or 2 x 8 to both sides of the dock so that the crows will not be able to fly down under and up to the swallow’s nests. The swallows should have no problem with this. Barn swallow do nest in loose colonies, but not side by side. You might get a second nest under your dock, but not close to the first one. On the purple martins, I have never heard of crows bothering then because purple martins do nest inside birdhouses. How do the crows get inside the house that has an entrance hole large enough for a purple martin to enter, but not a crow?