|
|
|
Ask HN: language choice for an iOS SDK in 2018
|
|
6 points
by alfageme
3100 days ago
|
|
During last year, after long and controversial discussions, our iOS team finally agreed to do a full rewrite of our main library. One of our managers got in touch with a freelance iOS architect to do some consulting on the side while the SDK project gets in initial design and development stages. Said architect has quite some experience with objC (+10 years) so his language of choice for every discussion. However, the whole team (~3 devs.) is still skeptic on whether to use Swift or its predecessor to start from scratch. The implications of keeping objC. as our library's main language could mean longer development times and less adoption (being an OSS project we also want users to get on board and contribute). Which language would HN choose? Which reasons would you guys give to some experienced architect to try out Apple's newer language? Would you say, in 2018 Swift is mature enough for this task? |
|
If your SDK is meant to be used from source, I'd recommend Swift. I'd even say you should prioritize providing a good Swift API over providing any Obj-C API at all (so if the API would work best if it uses enums with associated values or protocols with associated types, so be it, even if that means it can't be used from Obj-C).
You have mentioned the downsides of picking Obj-C, and they are both valid. There are no upsides to picking Obj-C though - Swift is more popular, and can do anything Obj-C can do (because it can piggyback on the Obj-C runtime when required), and do lots more that Obj-C can't do.
The biggest problems with Swift earlier were (1) Xcode crashing or being too slow and (2) the language changing every year. Both are pretty much fixed now.
At this point, the only reason an Obj-C expert would stick to Obj-C is familiarity - it's faster to code in a language you got to know well over many years. That's however not a reason for _your_ SDK to be in Obj-C.