My concern is that it's only used by a narrow range of products -- Android has taken something like 90% market share in mobile phones and I worry that in the long run Swift and the Apple frameworks aren't a good investment as a developer.
What are your thoughts?
You raise a good question about whether the investment is worthwhile, but if you earn money from targeting Apple platforms then it's a no-brainer.
When I was in the game industry, pretty much everyone I knew had the attitude that you had to be an expert in one language, C++, and it was career suicide to take a job working in a different language. But I've always felt that there's nothing wrong with using multiple languages. Over the course of my career I've had to use many different languages, at this point it doesn't seem like a big deal pick up another one. When I had to do a Unity game, it seemed like it took less than a month to get ramped up on C#. Just this year I've jumped back and forth extensively between Swift, Typescript, Elm, Elixir, Python, and Golang, while also doing some small projects in Agda, Haskell, and a few others. Yes, I do get the syntax mixed up, particularly right after a transition, and sure, I'd probably be more hireable if I honed my skill in a single language, but really learning a language is not such a big investment once you get the hang of it.
The Apple frameworks are a different story -- that's a bigger time investment, but it's incremental. You don't have to learn all of them to make an app, or to be productive in Swift.
[edit: fix typo]
There's no right or wrong answer here. Personally, I wouldn't define myself solely by using a single language. After working on projects using various domain-specific languages like 4GL and others, I would certainly bear in mind the risks that such a commitment would entail.
While other commenters have mentioned the large iOS market share and the size of Apple, I would also caution that neither guarantee the longevity of the language or the relevance of your skills if they ever decide to pivot to something new. And there's plenty of historical precedent for that--I'd argue that it's a matter of when, and not if, it will eventually be replaced.
Swift might eventually see wider adoption on other platforms. However, people are rightly cautious of vendor-specific and/or vendor-controlled languages, and I suspect its traction, like that of Objective-C, will remain low.
Yeah, the range of products is indeed narrow. But narrow in this case is 1.35 billion iOS devices (not even factoring MacOS).
> What are your thoughts?
iOS isn't going anywhere in the near future. You can have a long and happy career as an iOS dev. Build a few apps, apply for a job, give it a go. If it fails or your hate it, jump to something else.
If you think Android is 90% of the market and considering Kotlin is seeping rapidly into Android, this is a great time to do it. It's interchangeable with most of Java.