Move Description:
>The turn Wish is used, the user will make a wish. At the end of the next turn, the Pokémon in the user's current position will be healed by half its own maximum HP.
Scenario:
Turn 10:
Latios used Psyshock.
Sylveon lost 35% of it's HP.
Sylveon used Wish.
Turn 11:
Sylveon, come back!
Go! Bisharp!
Latios used Psyshock.
It doesn't effect the opposing Bisharp.
Sylveon's Wish came true!
Bisharp regains 50% of it's HP.
Answer:
No, you do not have to attack first before you are healed if you switch out, as switching out counts as a turn. However if you were to say in, then yes you would have to use a move first before you are healed, as you don't get healed until the end of the turn after you've used Wish. This is the reason why Wish + Protect is a very common strategy.
Source: Experience and Knowledge