Sooner or later, the U.S. economy will be hit by a recession. It's not a matter of if, but when. Some companies, like those that sell products people need to buy regardless of economic conditions, will hold up just fine. Others won't.

It's not unreasonable to think that Apple (AAPL 1.12%) would be at least resistant to an economic downturn. The company enjoys intense customer loyalty; its ecosystem of products and services make switching tough; and smartphones have become necessities, at least for most people.

But that's probably not enough to prevent some real pain for Apple when the economy turns south.

A broken smartphone

Image source: Getty Images.

Untested in tough times

Apple has been around since the 1970s, and the original iPhone launched in 2007, toward the beginning of the financial crisis. Apple managed to grow sales through the last recession, but the Apple of today is very different from the Apple of 12 years ago. The current version has not been tested by a rough economy.

Apple generated just $24 billion of revenue in fiscal 2007. The smartphone was new, and the iPhone was the best option available. The first smartphone running Google's Android operating system didn't even launch until late 2008, about a year after the iPhone made its debut. Samsung didn't announce its first Android smartphone until 2009.

Today, Apple's revenue has expanded by more than a factor of 10. The company generated sales of $265.6 billion in fiscal 2018, with the iPhone accounting for more than 60% of that total. The market for smartphones is saturated in developed markets like the U.S., and there's no shortage of non-iPhone options.

Loyalty doesn't guarantee sales

Apple's customer loyalty may be recession-resistant, but iPhone sales probably are not. Smartphone users have already been holding onto their phones longer -- the average U.S. upgrade cycle is now 33 months, according to Strategy Analytics. The same report puts the average active iPhone age at 18 months, with younger users tending to upgrade more often.

That number has room to go way higher during the next recession, especially considering that younger people who live in expensive cities with gobs of student-loan debt could be hit especially hard. Smartphones no longer change much from year to year, and 5G networks don't seem compelling enough to drive a big upgrade cycle, even in good times.

Apple's other products, like the Apple Watch, the iPad, and AirPods, aren't necessities at all. And much of the company's services revenue is tied to either iPhone sales or the iPhone user base. An iPhone sales slump during a recession is going to have second-order effects beyond a simple decline in iPhone revenue.

Apple will muddle through

Apple's financial performance will almost certainly suffer, perhaps greatly, during the next recession. But the company will muddle through, supported by the mountain of cash it's accumulated during the iPhone era. At the end of Apple's fiscal third quarter, the company had $210 billion of cash and marketable securities, partly offset by $108 billion of debt.

As fellow Motley Fool contributor Matthew Frankel points out (see the "economic downturn" link above), a recession will allow Apple to use its hoard of cash to make acquisitions at discounted prices. This would help lessen the company's dependence on the iPhone, and position it for growth once the economy recovers.

But it seems unlikely that Apple will be a safe haven for investors during an economic downturn. Sales could slump hard as consumers cling to their aging phones, even as many of those consumers remain entrenched in Apple's ecosystem. Customer loyalty alone is not enough to make a company recession-proof.