Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Pick the first option that applies to you: How far along are you in moving to Swift?

  • Originally Obj-C projects have finished moving to Swift

    Votes: 0 0.0%
  • I have read everything about Swift

    Votes: 0 0.0%

  • Total voters
    27

ArtOfWarfare

macrumors G3
Original poster
Nov 26, 2007
9,671
6,211
I'm curious how far along everyone is in transitioning to Swift.

Personally, I've played with Swift but I haven't actually used it in any projects. From time to time when writing Obj-C code, I ask myself why I'm still writing Obj-C code and haven't moved to Swift, yet. IE, today I was looking for how to use map on an NSArray in Obj-C. There's no great answer for it. Of course, Swift just has map as a built in function for Array.

And I don't have a reason for why not. I guess I'm still using it for the same reason I'm still using Python 2 - I feel like there's a big hurdle in moving forward. I feel like it'll be easier to keep dealing with the pain of using Obj-C for now and deal with going over that hurdle later. But maybe this just means that the hurdle is only going to grow larger.

IDK, has anyone jumped over the hurdle yet? Should I set aside the time to go over all my existing Obj-C code in the project and shift it over to Swift? Or should I wait until later to do that?
 
Honestly I can do everything I need with obj-c once I run into something I need it for ill mess with it but until then there's no need.
 
Honestly I can do everything I need with obj-c once I run into something I need it for ill mess with it but until then there's no need.

Both languages are Turing complete (as are C and Assembly), so you'll never "need" one or the other.
 
I got about 2/3 of the way through the BJR Objective C book and decided to switch over to Swift. Objective C had its moments but it's just so ugly, irritating, and seems to require a LOT of code to get a little actually done. Swift to me feels like a much more usable language and it gets out of the way which is what I like.

Swift is more like VB or Java and those are much easier to deal with.

Can't wait to dive in!
 
At work, we started immediately (Beta 1) with converting our internal app to Swift. All new development has been in Swift and there is not much Obj-C left in the project.

What really surprised us is how seamless the Swift->Obj-C and Obj-C->Swift transitions are. I am really liking the functional aspects to swift, as it feels more like Groovy (with type safety) -- and thats a great thing!

As for my personal apps in the app store, no I haven't done anything with them since I was at WWDC. I have been too busy, but I don't plan on writing anymore Obj-C for them, as all new development on them will be in Swift.
 
I too, started rewriting my app from obj-c to swift since Beta 1.
Already converted around 20k lines from obj-c to swift. I was hoping to have my app ready for ios 8, but I'm happy enough to delay the next release while I get everything right.

So far, working with swift has been a complete pleasure (minus the expected beta bugs), and I find myself making better designs in general. However, that could simply be due to the fact that I noticed the flaws after many iterations previously.

I was happy when swift was released, since it gave me a reason to do a total rewrite of my app. I know I can mix and match objc/swift code, but I wasn't really keen on doing that.

I do have some objc code wrapped around c code. Some C Apis are just quite difficult to use in swift. Specifically the opaque pointers, mutable pointers, direct memory access, etc. So instead of spending an insane amount of time on that stuff, i just code those parts in obj-c.

I don't see any real reason to stick with Obj-c, especially for new projects. It's quite possible that you will need to touch obj-c still, but I believe it's possible to use swift for almost your entire code base.

I'd say, if you can afford to delay your next release to convert your code to swift, go for it. If not, simply do the incremental approach. Sometimes you just need to say, screw it, and dive in.
 
I think it makes sense to take a "middle of the road" approach in terms of languages and frameworks. This means waiting until a non beta stable release, and some more real world use. As an example, the range operator has changed since the initial spec was revealed. I don't think there are any gains in converting an existing working Obj-C application to Swift.
 
I'm a hobbyist, and as such, run into bugs when branching out in new directions with my programs. It always seems that what I'm doing SHOULD work, but doesn't, usually for some strange esoteric formatting problem that I eventually find by digging through StackOverflow or the docs.

The last thing I would ever consider doing is messing with a language that was in beta.

I'm looking forward to diving in to Swift when it becomes a finished product, no sooner.
 
I think it makes sense to take a "middle of the road" approach in terms of languages and frameworks. This means waiting until a non beta stable release, and some more real world use. As an example, the range operator has changed since the initial spec was revealed. I don't think there are any gains in converting an existing working Obj-C application to Swift.

There is the value of learning the language better, and its cool to see how much simpler/safer your code becomes :)

Also, if you keep up with each beta, the changes are not that hard to stay up with... ".." vs "..<" will hardly make you lose significant time in fixing ;)

But I agree, there is no rush to jump in, we were just very anxious at work :)
 
is it true that Microsoft might adapt the swift language as well?


i read that swift is so powerful that eventually everyone will be writing in swift
 
is it true that Microsoft might adapt the swift language as well?


i read that swift is so powerful that eventually everyone will be writing in swift

I find this statement hilarious. Swift is leaps and bounds ahead of Obj-C, but Microsoft has their own languages which are similarly powerful. I find it extremely unlikely that Microsoft will go for Swift. But who knows - they have a new CEO now. Maybe they're finally ready to start putting together an ecosystem which is more interoperable and/or sucks less.
 
I just got a little question, since xCode 6 is still in beta.. I'm afraid I will have to reinstall back to 5 if things like.. private headers dont work on 6?

Can anyone give me a little bit more information like.. my Obj-C projects, will they still work with 6, can I still compile these with 6?

And like swift, is not compatible on iOS 7 and lower? So in the end you actually end up with 2 apps ? As like.. 1/3 does not upgrade their iOS devices.

Thanks!
 
I just got a little question, since xCode 6 is still in beta.. I'm afraid I will have to reinstall back to 5 if things like.. private headers dont work on 6?

Can anyone give me a little bit more information like.. my Obj-C projects, will they still work with 6, can I still compile these with 6?

And like swift, is not compatible on iOS 7 and lower? So in the end you actually end up with 2 apps ? As like.. 1/3 does not upgrade their iOS devices.

Thanks!

Obj-C is still compatible with Xcode 6 / iOS 8.
Swift is compatible with Xcode 6 and iOS 7 (but not older).

I haven't checked in awhile, but iOS 7 is probably at over 90% adoption by now, so if you update to using Swift, very few people wouldn't be able to use it. But if you want to keep them, you can stick with Obj-C for now and it'll still work with iOS 8.
 
@ DennisBlah

What do you mean reinstall? You can have both Xcode 5.x and 6 installed at the same time. There's no reason to remove the latest release version of Xcode, 5.1.1.
 
I hope to start to play around with it in 2015 when it is a final release and lots of bugs worked out. I am tiered of being a Beta Boy and having to deal with lots of bugs. It's tough enough just having the time to learn new code let alone new programming languages.
 
I started learning objective C in May and I have honestly been loving every moment of it. I was initially excited for Swift and I've played around with it once or twice. But I intend to finish learning Objective-C, since I can see how easy it will make learning Swift.

I don't really value terse programming languages. Verbosity, in my opinion, is a really good thing for a beginner like myself. Things like UITableViewDataSource are long to write, but the name alone tells you precisely what it is and you can immediately guess at what it does in Objective-C. In addition, you almost never have to actually type out the whole name, as Xcode is extremely good (IMO) at figuring out what you are trying to do.

I'm also waiting to learn Swift because I am not skilled enough to use an Xcode beta yet. In Xcode 6 it is sometimes impossible for me to figure out if I am doing something wrong, or if it is just a bug. I just built an app that models the orbits of the planets (with painstaking accuracy, using gravitational force equations, etc) and I spent 25 minutes trying to figure out why it wasn't launching. I searched through many lines of code in my app and couldn't figure it out. It worked perfectly in Xcode 5.1.1 so I figure it was most likely a bug.

Is Swift a lot less verbose? Is it harder to learn because of this, or not?
 
Last edited:
...But I intend to finish learning Objective-C, since I can see how easy it will make learning Swift.

...I'm also waiting to learn Swift because I am not skilled enough to use an Xcode beta yet. In Xcode 6 it is sometimes impossible for me to figure out if I am doing something wrong, or if it is just a bug. I just built an app that models the orbits of the planets (with painstaking accuracy, using gravitational force equations, etc) and I spent 25 minutes trying to figure out why it wasn't launching. I searched through many lines of code in my app and couldn't figure it out. It worked perfectly in Xcode 5.1.1 so I figure it was most likely a bug.

Is Swift a lot less verbose? Is it harder to learn because of this, or not?

Just wanted to focus on a few key points there. Continue learning Objective-C. It's not going anywhere for a long, long time. It will continue to be supported for many years. A lot of applications developed by Apple are completely written in it. They won't rewrite their apps overnight, or even over the next years.

The iOS and OS X apis were written and designed with Objective-C in mind. Therefore the APIs in swift can seem a bit awkward if you only know swift. Coming from a Objective-C background, one can easily understand the APIs behind it. (Although after 7 Beta iterations, the apis seem slightly more natural in swift now)

Almost all tutorials, books out there all focus on Objective-C. While there are new books and tutorials released daily on how to work with Cococa and Swift, there is already a ton of information solving the most common problems using Objective-C.

Most people don't have a problem learning Objective-C, as it is a very simple, tiny language. They mostly have a problem of learning the Cocoa/Cocoa Touch APIs. Some data structures, frameworks and so fourth can simply be confusing to new programmers. What they do, why they do something. If you learn the APIs in Objective-C, then using them in swift will take almost 0 transitioning time. The only thing you need to do is learn Swift.

Further more, there are some constructs that simply only work with Objective-C. Things like NSNotifications for example, although completely usable with Swift classes, you need to make sure your class is" Objetive-Cable". This either requires the user subclassing directly from NSObject (or an object derived from NSObject), or prefixing your swift class with @objc. This sounds absolutely easy to understand when you know Objective-C already, but if you only learn swift, sure you can accept it, but you will never know what's really going on in the background. One could say you never need to, but knowledge is power.

Even though XCode 6 is now released, Swift still has it's bugs in XCode. I have yet to try out the GM myself, but the people on the developer forums state that a lot of old bugs still exist. Mainly debugging information is still cryptic, sourcekit tends to crash, etc. I'd say, use it to learn swift when you have time, but focus on learning Cocoa touch in Objective-C.

Don't hold back and stay in XCode 5. App design is always a moving target. try to stay up to date
 
I started learning objective C in May and I have honestly been loving every moment of it. I was initially excited for Swift and I've played around with it once or twice. But I intend to finish learning Objective-C, since I can see how easy it will make learning Swift.

I don't really value terse programming languages. Verbosity, in my opinion, is a really good thing for a beginner like myself. Things like UITableViewDataSource are long to write, but the name alone tells you precisely what it is and you can immediately guess at what it does in Objective-C. In addition, you almost never have to actually type out the whole name, as Xcode is extremely good (IMO) at figuring out what you are trying to do.

I'm also waiting to learn Swift because I am not skilled enough to use an Xcode beta yet. In Xcode 6 it is sometimes impossible for me to figure out if I am doing something wrong, or if it is just a bug. I just built an app that models the orbits of the planets (with painstaking accuracy, using gravitational force equations, etc) and I spent 25 minutes trying to figure out why it wasn't launching. I searched through many lines of code in my app and couldn't figure it out. It worked perfectly in Xcode 5.1.1 so I figure it was most likely a bug.

Is Swift a lot less verbose? Is it harder to learn because of this, or not?

IMO, swift is easier to learn because of cleaner syntax and the fact that you don't have to include a bunch of stuff to get things working. I hated in Obj C how you had separate files for many things which should just be in one file.

Swift feels more modern and is more like Java or Visual Basic which are my favs when it comes to coding. Both of them have straightforward syntax, dot notation, and relieve you from all that mundane "under the covers" stuff. Obj C was just plain ugly to me.

Swift is wordier and less beholden to brackets, braces, colons, and all that ugly stuff. NO more semi colon line terminators either.....WOO HOO! That is sooooo 80's. :)
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.