I always thought they ate small insects. If they prey on dragonflies, that would be a major deal killer.
I am by no means a PM expert, but have done enough reading and on-site activity monitoring to know just enough to be dangerous...kinda like pond-meistering

.
Yes, indeed, dragonflies and damselflies are a part of their diet, but not exclusively. My response to Cecil's query may add more thought.
-
-
I have a lot of swallows around my ponds. If I tried to attract purple martins would they compete to the detriment of either species?
PM's spend a large portion of their feeding and food collection time high in the sky. They also travel far. During the period that they are raising their young, about 1 month, a little more time will be devoted working the closer/lower peripheral areas nearer the nesting site. This occurs, tho, only on the way out and back to the nest as part of the standard feeding M.O. noted above. The male and female will typically take turns feeding, trying to always leave a guard at the nest. Each one will usually take 5 - 15 minute shifts. As indicated, they still go very far even during the "family way".
Barn Swallows, conversely, stick close to the ground, methodically working the fields and meadows.