"Were you speaking with Iain?"
Translation:An robh thu a' bruidhinn ri Iain?
Pretty much for the same reason you use ri in comhla ri.
Ri is used to mean "to" when you are reffering to a person. Còmhla means "along". So it needs a preposition to go with it to imply who it's being directed at.
Bruidhinn is the same. You are speaking to someone, or speaking about someone, etc. So it pretty much always uses a preposition.