1. Thunderrise
  2. Blog
  3. Swift vs Objective-C: The Benefits of Using Objective-C
Swift vs Objective-C: The Benefits of Using Objective-C

Swift vs Objective-C: The Benefits of Using Objective-C

team
Thunderrise

2014 was the year of great change in mobile development and IT industry in whole, as the Swift programming language from Apple was introduced. Until there was only Objective-C for Native iOS development.

At the time of writing this article the current version of Swift is 3.0. But is it a good plan to accept new challenge from Apple and start building apps for iPhone new iOS app programming language? We have prepared 6 reasons why we remain loyal to Objective-C.

1. What is Objective-C? It's a proven and tested programming language. There are about 1.2m applications developed on this iOS coding language. That’s, to put it mildly, a lot of Objective-C code. And it is unlikely, that individual developers and companies that have done so many projects with this language will rush to rewriting the applications code in Swift. Why move to Swift at all when you invest so much in tools based on Objective-C?

2. There are plenty of training manuals and resources dedicated to Objective-C. Without any difficulties you can find dozens of books, hundreds of online courses, and thousands of interactive videos. Moreover, the iOS developers had time to figure out and share with their colleagues the best solutions and universal ways to develop someone or other things on Objective-C. As the phrase goes, “the code is brewed for a while”. Of course, Swift will also reach this point, but not in a year or two.

3. All these advantages of Swift over Objective-C that should persuade you to give up Objective-C and start working with Swift, in practical usage show nothing revolutionary. In point of fact, it is the same Objective-C but with a few pleasant additions like clear syntaxis, generics, and memory operations security. But still in most cases you will have to work with Cocoa frameworks and the Objective-c vs Swift differences won’t be significant. The features seem great but with several hidden pitfalls and a slight feeling of exchanging sewed on soap when you dive into details. Thus suffers the capacity, as you have to work with raw compiler.

It seems that it’s more of a problem with intussusception. Apple, in their traditional manner, promises something outstanding, but what turns for real is a reasonably good language. But after studying really fresh conceptions influenced by Go/Rust it seems like it’s late for the party.

You can see that Swift is an integrated data file without dividing into separate parts (interface and implementation).

Here is illustrative Swift vs Objective-C comparison

Objective-C

  
  @interface Animals : NSObject
  - (void)cat;
  @end

  @implementation Animals
  - (void)cat { }
  @end
  

Swift

  
  public class Animals {
    func cat() { }
  }
  

4. Swift works only with iOS 7 and higher. If the compatibility with wide range of OSes is required then it will be hard to nail it without Objective-C. If not, then you can start with Swift.

5. There is a good practice of code re-use, when you can use functional mechanisms from finished project in the project you are now working on. It considerably reduces the development time and makes your life easier. This will work with Objective-C, but not with Swift. Most likely, you will come up with some technical difficulties trying to launch the project finished half year ago. You will have to make code refactoring first due to syntaxis changes. Of course, Apple has embed the migration mechanism that updates from early version to the newest, but on practise it goes not so smoothly and you have to make many fixes manually. This turns into extra time for developer and extra money for the client.

It stands to mention, that Objective-C has more structured and clear encapsulation principle. At the same time you will have to put everywhere “public/private/internal” in Swift. Also Swift enables to put properties anywhere in the code which brings down the code structure, hence it’s harder to read the code.

Objective-C

  
  @interface Animals : NSObject
  @property (nonatomic, copy) NSString *text;
  @property (nonatomic, assign) NSNumber *number;
  - (void)cat;
  @end

  @implementation Animals
  - (void)cat { }
  @end
  

Swift

  
  class Animals {
    var text: String!
    func cat() { }
    var number: Int!
  }
  

6. Working with С\С++ libraries is much more comfortable with Objective-C. And this is not surprising, as it is Smalltalk add-in above C to reach OOP (Object Oriented Programming) paradigm.

We have viewed Objective-C advantages and disadvantages in comparison with Swift.

Of course, Apple is continuing the works on Swift and we can see the results with every update, but still, it is rather unstable. So, it's quite risky for companies with a great number of ready-made solutions in Objective-C to switch to Swift. And in our humble opinion it is better not to rush into Swift for at least a couple of years.

No matter how good Swift will be the developers should not give up Objective-C completely. Having studied both these languages will increase skill level and expand the field of expertise. It’s better to study Objective-C first and then switch to Swift, not to waste precious time on thinking about so called Swift vs Objective-C conquest!

No matter how good and promising Apple’s new iOS app programming language is, developers should not abandon Objective-C completely in any case. On the contrary, to become a skilled programmer and a real pro one has to learn it before moving to Swift. Don’t forget that all Apple frameworks for developing on iOS and Mac OS and a great number of apps are written in Objective-C. We have to pay tribute to its global role in development.

In spite of all Swift advantages and disadvantages, the main reason for choosing it for your future app is the devotion of progressive developers to it. They simply love it! They can be very interested in working on apps built in Swift which is certainly profitable for clients. There is no better motivation and guarantee of quality than personal involvement in a project.

That's your lotIf you have more concerns when it comes to a question "Objective-C or Swift?", please contact us and Thunderrise Dev Team will provide with undeniable quality Objective-C code, so you won't have any more doubts.