Like many tech stocks in 2022, Apple's (AAPL -0.35%) shares are down year to date with a loss of 22%. Rising inflation and interest rates have hurt consumer spending and other parts of the economy, leading to a stock market sell-off. The Nasdaq Composite index is down 32% so far this year.

While Apple stock has suffered, it has still fared far better than many of its technology peers. For instance, Alphabet and Microsoft have dipped 39% and 32%, respectively.

The iPhone company has proven it's capable of successfully pushing through poor market conditions. Here's why Apple is a must-buy after its considerable dip this year.

Beating the odds

On Oct. 27, Apple released its fiscal 2022 year-end financial report, beating Wall Street's expectations on revenue and earnings per share (EPS). The company reported an EPS of $1.29, versus an expectation of $1.27, and $90.15 billion in revenue against the analyst consensus of $88.90 billion.

The promising results come after months of media reports that Apple was headed for turmoil, with suggestions that sales of its 2022 iPhone lineup were significantly lower than in previous years, and its services business could be in trouble if consumers continue to cut their discretionary spending.

For the full year, revenue rose only 7.8% compared to the 33.2% surge seen in fiscal 2021. Growth slowed considerably, but it's important to remember the meteoric rise the tech industry enjoyed last year as consumers homebound during the pandemic invested in home-office and entertainment devices. In fact, all of Apple's segments in fiscal 2021 saw growth between 20% and 40%.

Despite the uneven year-over-year comparison, all but one of Apple's segments reported growth in fiscal 2022. For example, iPhone sales grew 7%, which the company attributed primarily to the success of its iPhone 14 lineup, released in September. Meanwhile, its Mac segment rose 14%, wearables 7%, and services 14%. The only segment to decline was iPad, falling 8%, which the company said was due to lower iPad Pro sales.

However, the last iPad Pro release was in May 2021. The newest version only came out in late October, meaning it didn't contribute to Apple's fiscal 2022 results.

Apple didn't have a perfect year, but its growth, despite ongoing market conditions, reinforces its reputation as a dominant, reliable company to buy and hold long term.

A cash machine 

As fears of a recession grow, cash flow is becoming an increasingly important metric that illustrates a business's ability to weather an economic downturn. And once again, Apple stands above all with free cash flow of $111 billion in the past year.

AAPL Free Cash Flow Chart

Data by YCharts.

That's enough cash generated in a single year to cover the company's nearly $120 billion of borrowings, not to mention the $169 billion of existing cash and marketable securities on its balance sheet.

The rise of Apple's services business is especially promising in terms of cash. The segment, which includes digital offerings such as Apple Music, TV+, and iCloud reported a gross margin of 71.7% for the year, compared to 36.3% for Apple's products business. In fact, margins for the entire company have been expanding in recent years.

Apple is an industry-leading business that can thrive in a recession or bear market. The stock has dipped considerably in 2022, but that should only make it more attractive to investors.