I wish /if only + past tense expressing a wish or regret about a present situation we want to be different:

I wish I were taller (it's a pity I'm not)

I wish (if only) + could + bare infinitive wish/regret in the present concerning lack of some skill

I wish I could swim (but I can't)

I wish (if only) + past perfect expressing regret that something happened or didn't happen in the past:

I wish I hadn't spent so much money (but I did)

I wish (if only) + subject + would +bare infinitive expressing a wish for a future change unlikely to happen or a wish to express discontent:

I wish you stop playing those games

I wish (if only) + inanimate subject + would + bare infinitive, expressing the speaker's dissatisfaction or lack of optimism:

I wish it would be sunny (but I'm afraid it won't)