Soon two years from when the Swift language was officially introduced, but its state remains uncertain. On the one hand, in the “most favorite languages” top on Stack Overflow, it is in second place - it is clear that Apple liked the attempt to “improve Objective-C”. And on the other hand, in the top of the "most used" it is not there - there is still Objective-C. Moreover, it is
reported that Apple itself is not really using its own language in iOS, so far it has implemented only a calculator.
One of the reasons is that the language has not yet reached the stability of ABI: now no one guarantees that after the release of its new version your code will not break. However, Apple called the top priority fixing this situation. And recently version 3.0
appeared on the horizon , which should bring a lot of new things. Does all this mean that it is time to take Swift seriously, or is the expediency of using it still a big question?

')
We decided to ask about the present and the future of the language of three specialists from large companies already using Swift and familiar with the topic. Our questions were answered:
- Maxim Sokolov (Avito);
- Igor Kashkut (Badoo);
- Yegor Tolstoy (Rambler & Co).
How actively is Swift used in your company?
Maxim SokolovAvito develops several mobile products. Our team is working on three mobile applications. We actively use and will continue to use Swift. One of our apps is written entirely in Swift and is available on the App Store. We began to write two others on Objective-C, but at the moment all new code is written only on Swift.
Igor KashkutWe not only use Swift, but also published
a part of our project
on GitHub . Chatto was the first sign, the breakdown of the language in our CI infrastructure and the project as a whole - not without problems, of course, but it was a success. In the future, we plan to use Swift in the rest of the application.
Yegor TolstoyNow at Swift, we are developing two projects. One of them, originally developed in this language, should appear in the App Store within a month. The second, Rambler. Mail, was originally written in Objective-C, but after the first release as part of refactoring, the team began to gradually translate it into a new language.
What did this experience give? What pitfalls did you encounter? Do you recommend using Swift to others, and in which particular cases?
Maxim SokolovUsing Swift has both advantages and disadvantages. I would consider the disadvantages, firstly, problems from the IDE Xcode side - the compiler crashes, Xcode itself may happen, syntax highlighting may fall off. Secondly, the language itself is still very young, sometimes some tools are missing: for example, the community still lacks an adequate mock framework to help write unit tests. There is a great lack of good old OCMock, whose support in Swift leaves much to be desired.
Some language constructs can significantly affect the compile time, such problems are sometimes introduced into a stupor. Also a big problem now is the lack of support for refactoring by Xcode. It is necessary to take into account the upcoming release of Swift 3.0, somewhere breaking backward compatibility. Hopefully, Apple will take steps to improve the situation.
But, despite all the flaws, I would still recommend that developers start using Swift. Apple is very actively developing it, and we see interest in the language from other large companies, such as IBM. Companies need to think about this investment in the future, so Avito already has an app in the App Store, written entirely in Swift. Swift helps us significantly improve the quality of the product and has a positive effect on the speed of development. Strong language typing allows us to write more secure code whose behavior is predictable. New language constructs, such as generics, which are absent in Objective-C, make it possible to take a fresh look at the architecture of the application as a whole and make it possible to write code that can be reused effectively.
Igor KashkutWe have not encountered anything that would be impossible to overcome, all problems can be solved. Where the bug was in the language (by the way, it is often repaired with new versions of the compiler, they are great), where it was necessary to tweak the old code so that it could be used in the swift. But in general, everything is going quite well. Personally, I do not see the point in starting a new project on Objective-C, write directly on the swift. Unless you need interop with C ++, this part still needs to be done on objc, the interop simply does not have interop. But again, and this is solved, you can do on objc and top swipe the swift.
Yegor TolstoyAn interesting experience - first, they caught a lot of different pitfalls, and learned how to cope with them. Secondly, they understood that it was necessary to urgently write a code generator - the time required to manually create mock classes for writing unit tests is simply unrealistic. And, of course, like all the others, they managed to get into trouble with the compile time. Now we are engaged in its optimization.
As for the recommendations - a good question. As in most other cases, there simply cannot be a definite answer. You need to look at a specific project, its team, and business requirements. If the project is very large and long-playing, I personally still lean towards Objective-C.
How do you expect what will happen with Swift over the next year - for example, will there be a big increase in popularity with the release of version 3.0? Could it also be in demand outside the iOS ecosystem?
Maxim SokolovI can already note the great popularity of Swift. And in the coming year, we will surely see the use of Swift outside of iOS mobile development. Swift is an open source project, and we can already see the emergence of frameworks for working, for example, with backend and databases.
Igor KashkutFrom my point of view, version 3.0 will be a truly normal version 1.0 - children's problems will be closed, there are guides, there is a Package Manager, the source codes are attached. I do not expect a big jump in popularity, the language will not change in principle - there are no obstacles to start doing something now. I expect that growth will take place more smoothly, as new projects appear - there seems to be almost no reason to start something new in Objective-C.
As for the use outside of iOS (OS X, watchOS and tvOS), then everything is not so rosy. With iOS, everything is clear, there was no choice before, in the future it will not be either. Swift as a language has no "chips" that would encourage developers to use it. Compare with others: Go is simple and it has gorutiny; Scala is about strict and flexible typing, but on a multi-year basis of JVM; Clojure - lisp with an interesting ideology embedded in the language, on a multi-year basis JVM; JavaScript in the form of Node.js allows you to have the same code on the client and server, which opens the way to isomorphic applications + the programming model in the node is very simple and understandable to most web developers + npm, where everything is there. Rust is such a new secure C ++, where everything is under control, with an understandable overhead and the ability to use without runtime.
Swift takes a bit of everything from everyone, it is very good, but I still do not understand what niche it can take. I myself am very interested, but all that remains is to observe.
Yegor TolstoyI think that in the coming year, the HYIP will gradually decrease. On the other hand, the community is growing up, new architectural approaches, components and libraries are being developed that will simplify the life of developers - so there will be more arguments in favor of its use.
It’s too early to talk about demand outside the ecosystem, in my opinion, time will tell.
On June 4, at the St. Petersburg
Mobius conference, all respondents will give presentations on iOS development. One of their reports will be directly about Swift: Maxim Sokolov
will talk in detail about the use of generics in it. If after this material you feel that the time has come for your project to use Swift - do not miss it :)