Of course this was never true. It was only because Apple had such a small share of the market that it wasn’t a target.
Any operating system is vulnerable to malware and viruses.
On my Mac gear I run AVAST. It does a good job and every morning I get notices when it detects a problem.
I still have people tell me they are going to switch to Mac because they want to move away from computer viruses.
Mac does still have fewer viruses and malware specifically written for it, but it is not immune.