I know of several people who start learning to code in their mid 20’s, and are doing fine now.
However, it’s very subjective what a “good living” is.
Compared to the rest of society, programmers (anyone who writes code) and software engineers (a subset of programmers, with more emphasis on “engineer”) might make a relatively higher salary.
However, just as with any field, there are different grade levels, and how well you do depends on what level you are able to attain, and that has a correlation to how much time you spend working on your craft.
If you work hard and dedicate yourself to software engineering now, you can probably make a decent living in 2–3 years. Whether that will exceed your earning capacity in whatever other endeavors you may try, or are currently in, varies widely depending on your individual background, circumstances, opportunities, and experiences (and ability to grow in all of those).
I think it may take 10–20 years of smart and hard work to get to the top tier of any field, software engineering included.
If you’re able to keep your head down and stay focused, go for it. If you’re easily distracted by others around you and are discouraged by others who seemingly effortlessly have more success than you, this may not be the path for you.
I have one friend who was working in the field of tech and executive recruiting, who was considering a switch to software engineering when he was already in his early thirties. I quoted to him a proverb, “Do you see a man skilled in his work? He will stand before kings; He will not stand before obscure men,” and he decided to stay the course and excel in what he was already good at. Fast-forward two years and he’s now crushing it as an executive recruiter, making much more impact than he would have, compared to if he had switched his career to software engineering.