He didn't. There is not, and never has been an actual virus that can affect an iOS device. Not in macOS, either.
"Virus" is NOT a catch all term. It's a type of malware that self replicates. These do not exist for iOS or macOS.
Downloading a Trojan is something the user does on their own, knowingly or not. And it's the only way a Trojan can get on any computing device. The user has to initiate it themselves.
Is it possible in some way for your phone to be compromised? Sure. No system is impenetrable, but Apple's is pretty close. Those that can affect an iPhone or iPad directly are very few and far between. And of those, Apple patches the OS against them very quickly.
Most (as in, nearly 100%) of the "My iPhone has been hacked!" stories you read has nothing to do with the device itself. Rather, the crook got into the user's Apple account by learning, or guessing their ID and password. Once in your account, they can see and manipulate all of the same things you do. Email, photos, messages, contacts, etc.