With Apple (AAPL 0.30%) shares pulling back more than 12% over the past 30 days as of this writing, now is a good time to take a closer look at the stock. Many investors are probably wondering: Is this decline a sign of a poor investment, or is this a buying opportunity?

A closer look at the tech company and its stock's valuation reveals that shares are priced attractively after a sharp pullback. Here's why investors may want to consider buying some shares of the tech stock while they're trading at this level.

Why are shares down?

First, it's always helpful to know why shares are trading lower. The stock's recent retreat seems to be driven by two main factors: macroeconomic uncertainty that has weighed on the overall stock market and a recent statement from Apple saying that COVID-19-related government restrictions in China have pressured iPhone 14 Pro and iPhone 14 Pro Max shipments.

Capturing weakness in the overall market, the S&P 500 has slid more than 3% over the last 30 days as Wall Street considers the probability and duration of a recessionary environment amid inflation and rising interest rates.

Regarding the situation in China, Apple said in a Nov. 6 press release that "COVID-19 restrictions have temporarily impacted the primary iPhone 14 Pro and iPhone 14 Pro Max assembly facility located in Zhengzhou, China." This led to the factory operating at a "significantly reduced capacity" and ultimately led management to lower its forecast for iPhone 14 Pro and iPhone 14 Pro Max shipments. 

Investors should zoom out

While Apple could see a year-over-year sales decline during its important holiday quarter due to some of China's recent challenges, these issues are likely only temporary problems. The same thing can be said about the current macroeconomic environment. Historically, periods of economic growth, stagnation, and contraction come in waves. While the current environment may be one of contraction, this doesn't rule out a period of growth or even an economic boom in the years ahead. Investors who buy the right stocks opportunistically during times of pessimism could be rewarded handsomely during such a time.

An attractive valuation

The best reason to buy Apple stock is also the simplest. Trading at less than 22 times earnings at the time of this writing, the stock's valuation is attractive relative to the underlying business fundamentals. As a cash cow, Apple has generated more than $111 billion of free cash flow from less than $400 billion of revenue for the trailing 12-month period ended Sep. 24, 2022.

Further, management has historically been a great steward of its cash flow. In addition to paying a quarterly dividend that has consistently increased on an annual basis since it was initiated in 2012, the company has bought back more than $550 billion worth of stock at an average price of $47 since it started its repurchase program in the same year. 

All of this to say, even if revenue growth stalls for Apple in the interim, management will likely continue judiciously deploying capital to create meaningful shareholder value.

Overall, the stock looks extremely attractive at this price -- especially if history is any guide to the future and we do eventually return to a period of economic growth.