facebook
Article

Apple Swift won’t be Swift

June 25, 2014

Apple Swift won't be Swift

Swift

How long will it take for Swift to take over companies applications?On June 2, 2014, Apple presented the main novelties for 2014 at WWDC (Worldwide Developers Conference). Among them are the new Mac OS X Yosemite 10.10, iOS 8, Xcode 6 and Swift programming system, the new programming language.

What is new and what are the advantages and disadvantages of introducing Swift in application development in companies?

ProsCons
It is expected to be reliable because it is an Apple productIt is still in Beta, so App Store deployments can only occur after its launch
Its language is more modern and colloquial than Objc-CLack of existent features in the more mature, Objc-C
Error debugging is easierFeatures present in UIKit and AppKit can only be used with Objc-C
Good documentation and technical support from AppleDependence on pieces of Objc-C code
Possibility to program and test in real time using Playgrounds, that accelerate the developmentThird party libraries and source codes are only available in Objc-C
Higher performance (in some cases) than Objc-CThere are still no iOS community tutorials on Swift. The Objc-C community of developers is huge while Swift’s is does not exist
Automatic memory managementAs it is a fast learning language, it will cause an increase in competition in the App Store
Easy integration in the same Swift and Objc-C code application
Lower development costs since it is faster

Swift draws inspiration from programming languages such as Python, Javascript and Node.js, which are most modern and colloquial languages that developers know today. They are easier to learn, but at the same time more robust, not breaking so frequently.

Apple invests on Swift to accelerate the application development process. By turning away from the limitations of Objective-C such as the propensity to errors and the difficult and time-consuming learning process, developers can develop functional and high-performance applications more quickly and easily, thus reducing the cost.

Moving away from the density of Objective-C, will enable consumers to notice a big difference in terms of speed of the application and graphic quality. Apple presents performance comparative graphs in its keynote. In these graphs, Swift’s performance exceeds that of Objective-C.

Swift brings added value of an Apple product, a brand recognized for not releasing unfinished products. As so, developers can count on a reliable product with excellent support from Apple’s technical team. If the Swift experience goes well, programmers should expect Apple software development to be changed from Objective-C to Swift.

Swift enables programmers to develop code and to observe the results in real time through the Playgrounds tool. With Swift it is possible to modify the algorithm being developed, observing the result immediately in the programming environment without the need to compile the code.

On the other hand, current developers who develop high-level applications may suffer with the introduction of Swift. Currently, there is a small community of developers with the appropriate know-how to develop applications of great complexity. With the introduction of Swift, more developers will be able to compete with the former and distribute applications with a lower cost. With more developers to come into play, former developers will notice an increase in competition on both the App Store and on the labour market.

Swift
What should companies do?

At present, the Cocoa and Cocoa Touch frameworks are still written in Objective-C. Therefore, it will be required to write Objective-C code or at least mention it. Eventually, the majority of the code generated for applications will be in Swift. If this is true, then, in the near future, it will be necessary to make the transition to Swift.

Thus, the move to Swift is a corporate decision. However, nobody has the experience to develop applications in Swift. If the company is starting a new project, the hiring resources will still be learning. That won’t be a big problem because current iOS developers already know Cocoa and Cocoa Touch. Calling methods from these frameworks will has a difficulty level between easy and challenging.

Therefore making the change to Swift  from a corporate point of view is not too scary. The impact will be a slower initial development (in the first months) slower and after this adjustment period, the process will unfold at a normal pace. If all goes according to plan, developing software in Swift will become faster than developing software in Objective-C.

If you are starting a new project – and the schedule is not short (usually it is not) – beginning to change to Swift is a good investment. The development team will increase its knowledge which will be valuable in the long term. The introduction of Swift at this point is good for the team and for the project, because it is likely that the novelties in the frameworks are communicated by Swift code and also because the new APIs bring with them new features only available in Swift code. If the development team is in maintenance, or in the middle of a project the cost to make the transition from the base code to Swift will be higher and will not compensate.

In this way, the final question comes down to when the company intends to invest time and money for the change. If the company makes the transition to Swift now, it will pay more initially but will pay less in the future. If it uses Objective-C it will pay less in the short term, but will pay more in the long run.

Learning for developers

There are two types of developers to be taken into account. Those who already know the Apple development culture and those who are initiating the learning process. For new developers, it is not advisable to begin learning only Swift.

It is necessary to notice that the Swift language may not go forward as the primary development language. We are in an early stage and still in beta. Secondly, learning Objective-C is an essential requirement to understand and learn the way Apple wants applications to be developed. Thirdly, there are millions of lines of code in Apple projects and in third-party libraries that were written in Objective-C/C with which developers have to interact during a long period of time to be able to develop applications before they are ported to Swift.

If the developer starts by only learning Swift the following occurs:

  • There are no tutorials (in Swift) to teach the different aspects of developing for iOS.
  • He will not be able to publish any application in the store because the language will only be officially available in the Autumn.
  • He will have serious difficulties understanding the Objective-C code that Swift uses in its methods.
  • He will only learn one language that is in Beta.
  • He will have serious difficulties to port Objective-C code to Swift, because he does not understand it.
  • He will learn less programming languages.

Current developers are advised to initiate contact with the new language, not to be outdated. Since we are in an industry where evolution is very fast we cannot afford to lose the pace. Therefore, learning should be initiated as soon as possible.

Márcio Lopes, iOS Consultant at Infosistema; Master’s degree in Electrical and Computer Engineering, from FCT-UNL

Bibliography

https://itunes.apple.com/us/book/swift-programming-language/id881256329

https://devforums.apple.com/community/tools

https://www.bignerdranch.com/blog/preparing-for-swifts-unique-opportunities/

https://stablekernel.com/blog/implications-of-new-apple-swift-language-for-developers/

https://www.theverge.com/apple/2014/6/2/5773928/apple-swift-programming-developers-objective-c

infosistema Inet