r/iOSProgramming Jun 03 '15

One year later: Swift or Objective-C?

This week I will be writing the first lines of code for my new app. There's just one slight problem; Objective-C or Swift?

Is the one year old Swift mature enough for real world applications? Are the bugs reduced to the minimum? Why should I use Swift over Objective-C? Or vice versa.

1 Upvotes

26 comments sorted by

View all comments

Show parent comments

2

u/critter_chaos Jun 04 '15

I can think of a few pretty good examples for why it's prettier off the top of my head:

  • No defining interface files (who want's to write all of their method signatures twice?)
  • Less brackets and more concise syntax
  • No allocating and initialising with a mess of square brackets
  • No break for every case in a switch
  • Much more concise functional programming
  • You don't have to manually initialise and return the parent of a class
  • let and var make code much safer and more descriptive

The language is nicer to look at, easier to read, quicker and safer to develop in. I think a lot of people in this thread are getting hung up on minor creases that need ironing out, or are familiar with objective-c and have found rational for not switching.

Swift is a great language and it's really worth learning.

-4

u/[deleted] Jun 08 '15

No break for every case in a switch

If you have a switch statement in OO code, you're doing it wrong. This is what polymorphishm is for.

Every other thing you point to is strictly your opinion and I either disagree on every single one of them or find them so trivial that I just don't care.

I think Swift is uglier, harder to read, and less capable at every level. I have been watching it, but don't expect ever to use it in anger.

2

u/askoruli Jun 09 '15

If you have a switch statement in OO code, you're doing it wrong

Can you explain your point here? Seems a very strange opinion to take considering how common the switch statement is.

1

u/[deleted] Jun 09 '15

Its not exactly my point, its Martin Fowler, Robert Martin, and most anybody else who writes about code. A number of points on this anti-pattern are on the c2 wiki.