Back in 2015, on the WWDC stage, Craig Federighi announced to the audience that Swift would become open source. The statement took a lot of people by surprise and was very celebrated by the iOS and macOS community. This meant Swift would be open to more developers to use it in their projects, opening a huge door to the Apple world.
It's well known that Apple doesn't usually - or almost never - opens they beautiful walled garden. They like to keep people living inside those walls, where everything works. This is very noticeable when you try to make their products compatible with some outside products as it's almost guaranteed that you'll find compatibility issues at some point.
But in this case, they decided to share a little bit and allow everyone to join and contribute to the growth of Swift. Bold move, but does it mean that things are changing in Cupertino, or was it just a strategic move?
Why Open Source?
The concept behind open source is to provide free usage, distribution, and modification of the code. This means that anyone can fix bugs and solve problems, while also making it easier to find the bugs, since you'll have a whole community looking into it.
This way, the solution can be found by a large number of people and not just by the team that developed the language. It provides security to the language and it attracts a whole lot of new developers with experience in other languages that can help the code grow and mature.
This is the upside of Apple's Swift, but the developers also get a lot from it. Open-source languages bring more people to them, allowing faster growth, generating more interest and increasing their popularity quicker. This results in a constant stream of new features that benefits both sides.
Apple is happy with the help of the community and the community is happy to receive a good stable language with a lot of support to develop. Sounds perfect, right? Well, yes and no.
Something is happening.
Build it up, break it down
Swift replaced Objective-C as the language in use to develop for iOS and macOS apps. It's a new fresh language that gives developers a simple and cohesive syntax that was influenced by other well-known languages like Ruby and Python.
When Swift became open source it got the attention of a large number of programmers. Its popularity rose and a lot of commits and pull requests were made in GitHub. Consequently it grew with the community and kept growing in the following years.
The language is today more mature and has a lot of new features. This evolution made it more desirable and the fact that it can now be used in the server-side is great. In this aspect, IBM also played a part.
"When swift.org was released in December, one of the first things that we wanted to do was to help grow the developer ecosystem. We saw the value of the language, and we wanted to quickly introduce it to other developers." - IBM
IBM is using Swift since the beginning in diverse projects and helping it mature. They are also creating a lot of enterprise apps and tools to work on the server-side (Kitura) and everything about it looks good.
However, this fairytale is not perfect. Something happened and Swift's popularity is drowning, like TIOBE reports.
One reason for this decline is the fact that many developers can be very tempted to work with multiplatform frameworks, where they can develop similar mobile apps for iOS and Android. Even if it isn't the same as building native apps (they often result in more problems and less possibilities), the outcome can be cheaper and faster.
Additionally, other frameworks are appearing and they're generating a lot of interest, as the popularity of the likes of Xamarim, Apache Cordova, Ionic and React-Native is constantly increasing.
“Until recently, it was quite common to program Android apps in Java and iOS apps in Swift/Objective-C. This is quite cumbersome because you have to maintain two code bases that are doing almost the same thing.” – Paul Jansen, Tiobe CEO
Swift for Android?
This is a controversial topic, but seeing Swift in Android, bringing the development of both platforms closer, would be very interesting.
Some time ago, there were rumors that Google would use Swift on Android, because of the problems that they were facing with Oracle. However, even if they managed it, another problem would surface.
Although Swift is open source, Google would depend on Apple instead of Oracle. Even if they wanted to fork the code, it would take a lot of work just to maintain it.
The effort that it would take from the Android developers to learn Swift would be painful and a lot of them are not motivated to do so. And let's not even talk about compatibility issues. In any case, the question remains:
Is it possible to build a Mobile App in Swift for Android?
It's not easy, but it's not impossible either. In a presentation in 2017, Eric Wing shows his process and how he did it.
It's not simple, but basically, he starts with Java, because Android needs an activity to start with, and then calls a native function that is written in C. Next, he calls a function that looks like a C function, but is, in fact, a Swift function.
Confusing, but it works. Could we make it standard? No, the workaround to get it done just isn't worth it. The point is, even Google is using Swift and contributing for it, doing pull requests for the language. This shows how impactful it can be for a language to be open source.
The future of Swift
Swift is a language that became open source, received a lot of help from the community to grow and matured over the last few years. The app development from iOS and macOS changed a big deal with this, but given the incredibly downturn in popularity, how good will it be in the long run?
Only Apple can say what the plan for Swift is, but the fact is that after 4 years, the language is now more mature than ever and, contrary to what could be expected, it's also getting a bit unstable because of the loss in popularity.
Definitely, the developers that create native apps are not going to abandon Swift anytime soon, as there's nothing like a native app with good performance and a good flow. However, it surely seems like something has to change for it to keep growing.
Overviewing it now, it was indeed a very bold move, but one that had a major positive effect on Apple and proved to the skeptics that the company could be more open and accept the help from the outside world.
Maybe opening more of their products to the community could attract even more people, even those who are not so keen of their walled garden. Swift showed that, undoubtedly, good things come from sharing.
One could question why Apple doesn't share more often, but, looking at it from another perspective, why should they bother if everything works so well inside their own garden?
After all, for those who are living inside the walled garden, it surely is a beautiful world.
At Imaginary Cloud we have a team of experts on mobile app development. If you need help building a scalable mobile app, we are waiting for you! Drop us a line here!
Found this article useful? You might like these ones too!