Apple Swift Makes iOS and Mac Apps Development Easy

Apple’s New Free Programming Language – Apple Swift is set to make iOS App development easier than ever. Apple announced a totally new programming language known as SWIFT, for Cocoa and Cocoa Touch, at WWDC 2014.

It is a big deal for Apple as they launched a new programming language after a long break of approx. 17 years. Claims are been made that it is dominating the iOS devices and MAC OS X programming world – already.

The article is an effort to answer some of the initial questions such as:

  • What is Apple’s Swift programming language?
  • What are the advantages of programming in Apple Swift?
  • Where will I get Apple Swift for my Mac?
  • Is it easy to learn Apple’s Swift if you know Python? Or Is Apple’s Swift programming language better than Python, as Apple claims?
  • Should I use Swift or Objective-C to learn iOS development?

What is Apple’s Swift Programming Language?

  • It is a totally new programming language for Cocoa and Cocoa Touch
  • Swift programs, latest edition of Apple’s integrated development environment (IDE), use Xcode 6
  • Though new, it is designed to integrate well with existing Objective-C programs
  • You can add Swift code to existing apps without replacing all the older Objective-C code
  • It also allows you to reduce common patterns of Objective-C code to a simplified code
  • Since day one you can submit your apps written in SWIFT to the app store
  • Apple Swift is fast, modern and designed for enhanced safety
  • It offers developers the freedom and capabilities required to create next gen applications
  • Enables a level of interactivity and development which never existed with any programming platforms
  • Is dominating the iOS and MAC apps programming world – already

What are the advantages of programming in Apple Swift?

Or What are the key features of Apple’s Swift language? Or What should I know about Apple’s Swift programming language?

Apple has been harping on the advantages SWIFT has over Objective-C code. But I am strongly of the opinion that the language is relatively new and hence we should wait and watch what it has for the developers. However; let’s check out on some of the reasons that are making rounds as to why Apple’s Swift is a better programming language if compared to Objective-C:

Clean Syntax of Apple SWIFT

Basically, SWIFT is designed to be a programming language that can be conveniently read and coded. May be that is the reason why it does not need semi-colons at the end of each line and at the same time the functions are much easier to understand.

Humble Print command is NSLOG in Objective-C; in Swift that command is a far more familiar ‘println’. Very less symbols required to code while SWIFT is much more efficient than Objective-C.

Here is an example of how to write “Good Morning” program on the screen in Objective-C and Swift. Apple’s new SWIFT is simpler compared to Objective-C.

Objective-C: Good Morning

#import
#import <Foundation/Foundation.h>
int main(void)
{
NSLog(@"Good, Morning!\n");
return 0;
}

Apple Swift: Good Morning

Here is how the Good, Morning program looks in Swift:

println("Good, Morning!")
Code Expressive Swift

SWIFT proves to be much simpler and so cleaner to read and learn as well. Few of the features that Apple portrays as important for confirming that the code is expressive:

  • Closures unified with function pointers
  • Fast and concise iteration over a range or collection
  • Functional programming patterns, e.g.: map and filter
  • Generics
  • Structs that support methods, extensions, protocols.
  • Tuples and multiple return values
Managed Memory of Apple Swift

One of the most prominent advantages Apple Swift boasts of is about managing memory allocation – which is no more a headache for the developers. SWIFT privileges developers and programmers with initialized variables before use, arrays and integers that are to be checked for overflow while the memory is destined to be managed automatically. This in turn makes SWIFT language safer to use for developers who arefreshers or inexperienced. Managed memory of Apple Swift makes apps more reliable for developers and non- developers, both.

Where Will I Get Apple Swift for My Mac?

As I mentioned in the opening paragraph, SWIFT is a part and parcel of the Xcode 6 IDE – Integrated Development Environment. Xcode 6 is likely to get release on the App Stores for free along with Mac OS X 10.10 Yosemite in the autumn. Meanwhile if you are amongst those registered Apple developers or iOS or Mac OS X developer; and paying £69 per year, you may get the Xcode 6 beta from Apple Developer Connection.

Is it easy to learn Apple’s Swift if you know Python?

Or Is Apple’s Swift programming language better than Python, as Apple claims?

Being candid, I would say that Apple has successfully sold or oversold the speed of Swift by comparing it with Python. The real brain storming would have been a comparison between Objective-C and Swift. No one writes mobile apps in Python…what say? Anyways, Apple never made a pure value claim that Swift is better than Python, they were just trying to portray how fast Swift is against competitors. Swift is better than Python in so many ways and dissimilar/not as good as Python in some others. If compared on yardsticks of cross platform compatibility, third party libs, availability of developers and, simplicity of language Python definitely might have a cutting edge over Swift.

You all would agree that most of the comparisons of programming languages are very subjective as for different situations, a programming language could sweep you from the ground and for some it may even outshine another – remarkably.

Should I use Swift or Objective-C to learn iOS development?

It is likely that many of you would now have this question in mind. The trend suggests that developers are now inclined towards SWIFT as they find it to be a great programming language. Swift resembles a lot to Python, one of the highly regarded programming languages. SWIFT might prove to be a easier programming language for new comers, if compared to Objective-C.

Python is used regularly for programming classes and hence a lot of programmers are supposed to be familiar with a lot of Apple Swift Syntax.

Established and tenured developers also find the cleaner syntax convenient to use. So if you have already invested your precious time in gaining familiarity with Objective-C, you are likely to find lot of virtues about Swift that can make your life easy. Also not to forget, for current developers planning to move to a new programming language certainly means, learning new code, which might prove to be a distraction to your ongoing programming activities. But general consensus from developers suggests that SWIFT coding has the potential to pay off seasoned Objective-C developers.

SWIFT, or for that matter Apple, nowhere made a statement that it will be easier to move code from iOS and Mac OS X to other platforms, alike Android. There are a lot of developers busy articulating the benefits of swift development against further lock-in to Apple environment. Apple is supporting both Objective-C and Swift code for building Cocoa and Cocoa Touch apps, but no one knows till when? We eventually hope that it moves everything over to Swift.

One should be aware of iOS as Its APIs, terminology, Xcode, and many more that are mandatory for you to know about; irrespective of the programming language you select. It is really difficult to answer these particular questions – precisely!

Some developers are of the opinion to learn Objective-C first, as:

  • Swift, though released, can still call it to be in the testing phase. It is a comprehensive programming language, which may warrant thing to be fixed in near future.
  • Swift, the programming language is new and, the resources too are inaccurate. Courses & guides are not accurate and so need to wait for some more time for appropriate source materials.
  • Every single framework available for iOS development are written in Objective-C, hence it might take some more time to see it in SWIFT.
  • Learning Objective-C is bound to make everything easier, as if you learn the current language all the changes in future are easily adoptable, enhancing your confidence in app building.
  • Swift or Objective-C, they work side by side.
  • Learn iOS development to learn Cocoa Touch – Cocoa API is huge. Coding paradigms here are the ones you may not find in any other development environments:
    • First responders
    • File’s owner
    • Delegates
    • Data sources
  • Learning Objective-C will help you enormously with Swift.
  • Working for a client, developing as per schedule and working with a team, go the conservative way with Objective-C.

Some developers are of the opinion to learn Apple’s Swift first, as:

  • Swift is undoubtedly the best bet for general applications as of now.
  • It is easier than Objective-C.
  • If you an inexperienced programmer, Swift is a nice way to figure out whether you like programming or not.
  • Swift does have a playground, that offers the quickest reward of all 3 languages.
  • Motivation plays an important role, especially when you know what you created has a positive effect. C and Objective-C might take a long time by the time you create something tangible. However; with Swift – you may create something earlier and easily – for you to stay motivated.
  • Swift grows along with you, or you grow along with Swift, it is one and the same. Swift offers some commendable features and tools for intermediate as well as advanced level programmers.
  • Swift coaching has already started with a tagline of become Zero to Hero in two months, from not having coding experience to creating your own apps.
  • Are you looking for a job today or in coming two years? You should learn Objective-C to attain those highly marketable skills. But the future is SWIFT, it will give you skills that will be highly marketable after two years – (2017).
  • Working for self, and have the risk appetite, then go with Swift.
  • What do you want to do? Just create apps as a hobby in your spare time? Great learn swift… It’ll be easier to learn and quicker to get apps done.
I am of the opinion that:
  • Programmers or developers should certainly learn Objective-C. This you may not learn to upkeep the previous apps but at least to update critical components that play an important role to make them interoperable with Swift.
  • Apple has been really thoughtful about this pull and push of Swift Vs Objective-C, and hence released “Adopting Modern Objective-C” well in advance.
  • Learn Swift at the very first instance available, to help yourself learn how to migrate Objective-C to Swift.
  • Swift apps run only in iOS 7 and iOS 8.0

To add up, I would say that programming languages are just a part for the equation. The next step in it is to learn all the frameworks in the iOS SDK, responsible for providing similar APIs – irrespective of the app you end up using or mastering.A lot of controversial things said, heard and overheard.

 

I have tried and incorporated anything and everything here, however; feel free to comment and share your views and opinions – if I missed out on any of the points!

Like the article? Share it.

LinkedIn Pinterest

Leave a Comment Yourself

Your email address will not be published. Required fields are marked *