Apple's (AAPL -1.22%) stock performed admirably in 2023, with shares up 25%, despite severe headwinds. But as great as the stock has looked so far this year, it turns out even Apple is not immune to this dreadful economy.

Terrible effects from inflation, the war in Ukraine, unfavorable foreign exchange rates, supply chain constraints, and the aftereffects of the pandemic combined to send year-over-year revenue into a steep decline.

The worst part is that the economy might turn even more unfavorable for Apple. Recent U.S. banking failures have brought the economy to the brink of a recession. Should you even consider buying a consumer electronics company like Apple in this economy? 

Let's consider that question.

Consumers lack confidence in this economy

Apple's most significant revenue drivers, like the iPhone, fall into a category that economists call consumer discretionary: purchases that consumers deem nonessential but desirable when they have enough cash.

The main problem that consumer discretionary businesses like Apple have is that when consumer confidence in the economy drops, which happens in both extreme inflationary and deflationary environments, it is a sign that people have less cash to buy products like the iPhone.

The University of Michigan U.S. Index of Consumer Sentiment (ICS) is a monthly survey. The normalized ICS value is 100, assigned to the first quarter of 1966. Numbers at or above 100 signal an optimistic consumer and are an excellent sign for a consumer discretionary company. Conversely, the further below 100, the worse the economy.

The ICS value for March 2023 is 63.4, similar to some numbers recorded in the depths of the Great Recession in 2008. Considering that ICS numbers have steadily declined since the start of 2020, indicating that the economy has been worsening, it's little wonder that even mighty Apple succumbed over the last year with decelerating revenue growth, shrinking margins, and decreased profits.

AAPL Revenue (Quarterly YoY Growth) Chart

AAPL revenue (quarterly YoY growth) data by YCharts. TTM = railing 12 months; YoY = year over year.

It has a solid balance sheet

So why would anyone buy Apple? In a downturn where many companies' revenue and profits are declining, the best businesses to invest in are ones that have a solid-enough balance sheet to survive and quickly rebound when the economy eventually turns upward.

Apple has $51.35 billion in cash and short-term investments on the balance sheet against $111.11 billion in long-term debt.

AAPL Cash and Short Term Investments (Quarterly) Chart

AAPL cash and short-term investments (quarterly) data by YCharts.

The best measurements to determine whether Apple can pay off its long-term debt are the ratio of net debt to EBITDA (earnings before interest, taxes, depreciation, and amortization) and the interest coverage ratio.

At the end of its December 2022 quarter, its ratio of net debt to EBITDA was 0.47 -- outstanding, considering any number below 3 is generally seen as acceptable. Generally, the lower the number, the better the odds the company pays off its debt.

Apple's interest-coverage ratio at the end of 2022 was an exceptional 35.9. Most analysts consider the bare-minimum acceptable interest coverage ratio to be 2, meaning the company earns more than twice the cash needed to pay interest expenses. So Apple's balance sheet is unlikely to be distressed even should a recession occur.

It has several powerful competitive advantages  

Apple's most potent competitive advantage preventing competitors from gaining ground during this downturn is its integrated ecosystem of products and services designed to work best with other products within the iOS ecosystem. Only a few of its products and services operate with competing platforms, and often at reduced functionality. For instance, when people use AirPods on Android, it results in poor audio quality.

Apple users are often reluctant to switch to other brands since it can involve many hassles, like spending time and effort in transferring data, re-downloading apps on a new device, getting used to a new interface, or even changing payment services.

For instance, Apple Pay does not work on Android. As a result, many users will only buy the other products and services within its ecosystem, creating intense customer loyalty to the brand. In 2021, Consumer Intelligence Research Partners released a report showing that over 90% of iPhone users stayed loyal to the company. Meanwhile, Samsung's brand loyalty was below 70%.

Another significant competitive advantage of its ecosystem is its two-sided network effect. Each time another user joins Apple's installed base, its App Store becomes a much more attractive place for developers to build and sell their apps. And as more developers build apps for its ecosystem, the brand attracts even more users.

Apple's customers are often wealthier and more likely to spend higher amounts in the App Store than Alphabet's Google Play customers. So developers often view Apple's installed base of 2 billion active devices as more valuable than Google's customers, making it easier for Apple to keep and attract even more app developers.

Why you should consider buying the stock

This company is one of the consumer-facing tech companies most likely to survive this current downturn in great financial shape and thrive once the economy turns the corner.

If you are a buy-and-hold investor who believes in reliable companies that you plan to keep for at least five to 10 years, it would be hard to find a more rock-solid company than Apple.