Despite the recent roller coaster ride on Wall Street, Apple (AAPL 1.39%) has been a fairly consistent performer this year. Its stock price is up nearly 23% -- even after October's market dip -- while the broader market, as represented by the S&P 500 (^GSPC 0.24%) has gained less than 5% in 2018.

It took a combination of factors to drive the Cupertino company's stock to its recent all-time highs. Let's look at some of the biggest factors that played into Apple's rise in 2018, and see if those share price tailwinds provide any insight into what investors can expect in the future.

Crowds walking outside the Apple Store in Singapore at twilight.

Image source: Apple.

New iPhone appeal

The company made headlines this year when it become the first public company in U.S. history to top a $1 trillion market cap. While the milestone was largely symbolic, it was Apple's underlying performance that drive much of its gains.

When that 13-digit level was reached, the company had just reported its fiscal 2018 third-quarter results, which were unexpectedly strong. That outperformance continue in its fourth quarter (that ended Sept. 30), which topped off an impressive fiscal year. Revenue in Q4 grew 20% year over year, topping both analysts' expectations and the high end of Apple's forecast. These results were largely driven by near-record average selling prices (ASP) for the iPhone, which climbed 28% year over year to $793, just shy of the $796 that Apple reported in the first quarter. That number will likely continue to grow, as more consumers opt for Apple's top-of-the-line smartphones rather than its older, less pricey models. 

A legendary supporter

Apple's ability to consistently produce cash flow caught the attention of none other than Warren Buffet, legendary for his skill and acumen at identifying undervalued companies. Since the company first hit his radar, the Oracle of Omaha has purchased a stunning 250 million shares of Apple stock, currently worth more than $52 billion dollars -- a full 5% of the company's outstanding shares.

Apple's share price recently took a hit due to the slowing growth of the iPhone's unit sales, but that doesn't faze Buffett, who has chided investors who focus on a single quarter's numbers:

Nobody buys a farm based on whether they think it's going to rain next year or not. They buy it because they think it's a good investment over 10 or 20 years ... The idea of spending loads of time trying to guess how many iPhone X[s] ... are going to be sold in a given three month period, to me, it totally misses the point. 

Buffet has also said that he'd own 100% of Apple's shares if he could, as he "likes the economics of their activities." 

Warren Buffett smiling and being photographed in a crowd.

Warren Buffett loves Apple stock. Image source: The Motley Fool.

Shareholder-friendly

Another reason investors keep bidding up Apple shares is the company's shareholder-friendly capital allocation policy. Earlier this year, Apple raised its quarterly dividend to $0.73 per share. At current share prices, that yields about 1.4%, but with a payout ratio of just 23% of its profits, the company has plenty of room to increase its dividend.

The company has also been buying back its shares by the boatload. In the past four quarters alone, Apple has repurchased $73 billion in shares, bringing its total capital returned to shareholders to almost $90 billion in fiscal 2018.

More to come

Some investors say they're concerned that Apple's best days are behind it, but those fears belie its massive opportunities on several fronts.

Apple has been successfully growing its services business, which reached an all-time high of $10 billion in revenue in fiscal Q4, up 27% year over year, and is currently on track to top management's goal of $51 billion annually from services by 2020. This doesn't include the potential contributions of Apple's long-rumored (but as yet unseen) entry into the global video-streaming business. The launch, according to recent reports, could come as early as next year. One Morgan Stanley analyst calculates that an Apple streaming service could generate more than $37 billion by 2025.

Another area of significant growth is Apple's wearables, home, and accessories segment (formerly called "other products") -- which includes the Apple Watch, AirPods, Apple TV, Beats headphones, and HomePod speaker. In fact, it's the company's fastest growing segment: revenues rose 31% year over year to $4.2 billion in Q4. These ancillary products are part of a growing Apple ecosystem that its fans can't seem to get enough of.

Think long-term

The common thread that weaves its way through each of these points is that  Apple's growth story isn't over by a long shot. With customers gravitating toward the higher-priced iPhones, and with rapid growth continuing in the services and wearables, home, and accessories segments, the company still has plenty of runway ahead of it. And that's not even factoring in less clear potential catalysts, like its entry into video streaming, or other works in progress that the company may be keeping under wraps.

It has been a great year for Apple so far in 2018, but the best may be yet to come.