Ionic compounds are formed between metals and nonmetals, while covalent compounds are formed between two nonmetals, or, as is the case with tin tetraiodide, between an element that is a borderline metal (notice the position of tin on the periodic chart) and a nonmetal like iodine.