How far along is everyone with transitioning to Swift?

Discussion in 'iOS Programming' started by ArtOfWarfare, Sep 7, 2014.

?

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

  1. Originally Obj-C projects have finished moving to Swift

    0 vote(s)
    0.0%
  2. Originally Obj-C projects are being moved to Swift

    7.4%
  3. Most recently started project is in Swift

    11.1%
  4. I have played with Swift

    33.3%
  5. I have read everything about Swift

    0 vote(s)
    0.0%
  6. I have read somethings about Swift

    33.3%
  7. I haven't even read anything about Swift

    14.8%
  1. ArtOfWarfare macrumors G3

    ArtOfWarfare

    Joined:
    Nov 26, 2007
    #1
    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?
     
  2. TouchMint.com macrumors 68000

    TouchMint.com

    Joined:
    May 25, 2012
    Location:
    Phoenix
    #2
    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.
     
  3. ArtOfWarfare thread starter macrumors G3

    ArtOfWarfare

    Joined:
    Nov 26, 2007
    #3
    Both languages are Turing complete (as are C and Assembly), so you'll never "need" one or the other.
     
  4. s2mikey macrumors 68020

    s2mikey

    Joined:
    Sep 23, 2013
    Location:
    Upstate, NY
    #4
    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!
     
  5. Sean7512 macrumors 6502a

    Joined:
    Jun 8, 2005
    #5
    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.
     
  6. blueillusion macrumors member

    Joined:
    Aug 18, 2008
    #6
    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.
     
  7. subsonix macrumors 68040

    Joined:
    Feb 2, 2008
    #7
    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.
     
  8. iMacFarlane macrumors 65816

    iMacFarlane

    Joined:
    Apr 5, 2012
    Location:
    Adrift in a sea of possibilities
    #8
    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.
     
  9. Sean7512 macrumors 6502a

    Joined:
    Jun 8, 2005
    #9
    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 :)
     
  10. loon3y macrumors 65816

    loon3y

    Joined:
    Oct 21, 2011
    #10
    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
     
  11. ArtOfWarfare thread starter macrumors G3

    ArtOfWarfare

    Joined:
    Nov 26, 2007
    #11
    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.
     
  12. subsonix macrumors 68040

    Joined:
    Feb 2, 2008
    #12
    But Turing completeness is just a model of computability, it doesn't mean that anything is possible. ;)
     
  13. DennisBlah macrumors 6502

    DennisBlah

    Joined:
    Dec 5, 2013
    Location:
    The Netherlands
    #13
    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!
     
  14. ArtOfWarfare thread starter macrumors G3

    ArtOfWarfare

    Joined:
    Nov 26, 2007
    #14
    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.
     
  15. PhoneyDeveloper macrumors 68040

    PhoneyDeveloper

    Joined:
    Sep 2, 2008
    #15
    @ 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.
     
  16. larswik macrumors 68000

    Joined:
    Sep 8, 2006
    #16
    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.
     
  17. AxoNeuron, Sep 9, 2014
    Last edited: Sep 9, 2014

    AxoNeuron macrumors 65816

    AxoNeuron

    Joined:
    Apr 22, 2012
    Location:
    The Left Coast
    #17
    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?
     
  18. blueillusion macrumors member

    Joined:
    Aug 18, 2008
    #18
    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
     
  19. DennisBlah macrumors 6502

    DennisBlah

    Joined:
    Dec 5, 2013
    Location:
    The Netherlands
    #19


    Ahh ok! Thanks all!
     
  20. s2mikey macrumors 68020

    s2mikey

    Joined:
    Sep 23, 2013
    Location:
    Upstate, NY
    #20
    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. :)
     

Share This Page