Tech stocks have been some of the most lucrative investments in the stock market in recent decades. We've seen valuations skyrocket, industries disrupted, and many happy (and well-paid) investors along the way.

Despite how fast recent developments seem, most of these successes were decades in the making, not overnight wonder stories. That's why the importance of patience in investing can't be overstated.

For investors looking for tech stocks that they can hold onto for the next decade, Apple (AAPL -0.35%) and Taiwan Semiconductor Manufacturing Company (TSM 1.26%) (aka TSMC) are options you don't have to second-guess.

1. Apple

Apple held the title of the world's most valuable public company for a while until Microsoft recently passed it. Unlike many other big tech stocks that saw their stock prices surge through last year, Apple's stock price growth has lagged. Even still, Apple's "lagging" is it being up 22% in the past 12 months.

Investors have been concerned about Apple's decelerating revenue growth (particularly with the iPhone), but that's a cyclical issue that's been given too much weight. Smartphone sales across the board have been down, but the segment is poised to reverse course soon.

It's a down period for Apple, but when I think of companies I feel comfortable buying and holding onto for the next decade, Apple's at the top of the list. It's innovative, run by a world-class CEO, and with seemingly countless billions of dollars of cash readily available, it has the bank account to sustain practically any economic conditions that come its way.

The recently released Vision Pro was Apple's first truly new consumer hardware product since the Apple Watch in 2015. And while that's a reddish flag to some who question Apple's ability to keep innovating at past levels, it makes sense for a company that's prioritizing expanding its services footprint.

Apple's service ecosystem earns more consistent and higher-margin income. This helps offset some of the cyclicality of Apple's hardware revenues.

AAPL Revenue (Quarterly) Chart

AAPL Revenue (Quarterly) data by YCharts.

A decade from now, it's hard to imagine Apple won't have a more prominent position in the financial and healthcare industries. From ApplePay to the Apple Card to the Apple Watch to Apple Fitness, Apple has been slowly but very surely sticking its foot in the door.

Those could be huge growth areas for Apple, and investors will likely be happy they were along for the ride.

2. Taiwan Semiconductor Manufacturing Company

TSMC is one of the most important companies in the tech ecosystem, and has been for quite some time. TSMC manufactures semiconductors on behalf of a host of other chip companies, providing the computing power to some of the most prominent technologies in the world.

TSMC's business can be cyclical. When electronics like smartphones, computers, and game consoles are selling well, chips are in high demand. When consumers cut back on spending, companies aren't as inclined to place large orders for chips.

Smartphone chips account for a big part of TSMC's revenue (43%), so the recent slowdown in the industry has affected the company's revenue. Its fourth-quarter revenue was down 1.5% year over year, but that doesn't change the company's long-term outlook.

TSM Revenue (Quarterly YoY Growth) Chart

TSM Revenue (Quarterly YoY Growth) data by YCharts.

TSMC is one of many major names in the semiconductor industry. Its main competitors include Intel, Qualcomm, and Broadcom. However, it's clear their chips don't compete quality-wise compared to TSMC's chips when you look at how many top companies use TSMC as their go-to source. TSMC provides top quality and scale, which are essential to TSMC customers like Apple, Nvidia, and Tesla, which need high performance and reliability.

TSMC has many patents that give it a competitive advantage to help it maintain its spot as the industry leader. With the emergence of AI, TSMC should be able to further use it to its advantage, as many businesses seek its chips to power data centers and other technology essential to AI training and development.

TSMC's role in the tech ecosystem is in a position to grow over the next decade. I'd feel comfortable holding onto the stock.