Of the two versions it makes sense that the one that is combining two words into a contraction takes the apostrophe. Makes sense to me anyway, it’s how I remember.
Homonyms are where two words are spelled the same, yet carry different meanings. Both the possessive and contractive “it’s” are now homonyms. I have spoken.