Why are new API's still in Objective-C?

Discussion in 'iOS Programming' started by ghostlines, Jun 9, 2014.

  1. ghostlines macrumors regular

    ghostlines

    Joined:
    Feb 3, 2010
    Location:
    Amsterdam
    #1
    Hi, I was browsing through some developer docs from apple, and it seems new API's like healthkit are still written in Objective-C.

    I thought all new stuff would be written in Swift. So is the idea that you constantly have to map stuff from Swift to Objective-C, and thus still have to partially know the Objective-C language?
     
  2. T'hain Esh Kelch macrumors 601

    T'hain Esh Kelch

    Joined:
    Aug 5, 2001
    Location:
    Denmark
    #2
    Swift is not ready for full use yet, and many people know Obj-C and not Swift.
     
  3. sammich macrumors 601

    sammich

    Joined:
    Sep 26, 2006
    Location:
    Sarcasmville.
    #3
    Because every almost every single app for iOS is not written in Swift? You can't expect every single app to suddenly be written for Swift just to take advantage of these features. Besides, as it currently stands, Swift is still a beta language where source compatibility is not guaranteed.
     
  4. ghostlines thread starter macrumors regular

    ghostlines

    Joined:
    Feb 3, 2010
    Location:
    Amsterdam
    #4
    Thanks for the feedback. Makes sense because Swift is brand-new and still beta. I was hoping I could run away from still having to learn Objective-C as a new developer. But I guess we have a long way to go before that's the case. Guess you still gotta learn both.
     
  5. Menneisyys2 macrumors 603

    Joined:
    Jun 7, 2011
    #5
    Obj-C is needlessly demonized. Now that, with ARC, you don't need to manually manage the life cycle via retain/release of simple objects (not, say, simple C arrays on the heap), it has become considerably easier to learn.
     
  6. ArtOfWarfare macrumors G3

    ArtOfWarfare

    Joined:
    Nov 26, 2007
    #6
    I don't needlessly demonize it. Over the past year as I've learned languages like Python and Racket, I've come to realize what a pile of crap Obj-C is. There's a thread about "Objective C 3.0" somewhere here - I laid out there a list of my biggest complaints about Obj-C.
     
  7. ghostlines thread starter macrumors regular

    ghostlines

    Joined:
    Feb 3, 2010
    Location:
    Amsterdam
    #7
    I've played a little with Objective-C and program normally with Python. I like Swift's type inference and the code looks cleaner. I've seen that they're some Apple docs explaining how to interact with Objective-C API's via Swift.

    Maybe Apple hasn't gotten around to writing all the docs in Swift yet.
     
  8. MattInOz macrumors 68030

    MattInOz

    Joined:
    Jan 19, 2006
    Location:
    Sydney
    #8
    Check out the doc online in the developer portal instead of Xcode doc browser.
    There is a jump bar at the top of the doc's in the browser that lets you switch between Swift and Obj-C syntax for each of the classes.
     
  9. AdonisSMU macrumors 603

    Joined:
    Oct 23, 2010
    #9
    I think it's important to get some programmers eyes on it so Apple can find and fix the issues that might hurt adoption of the new language. Plus, they probably didn't make this decision lightly. I wonder if this new Backend as a service stuff is written in SWIFT.
     
  10. firewood macrumors 604

    Joined:
    Jul 29, 2003
    Location:
    Silicon Valley
    #10
    Swift is still in beta. Apple wants developers to use all these new APIs in tested production code and real apps, not just in flaky beta testing playgrounds.

    But well after the beta is over (a year or two from now), I wouldn't be surprised to see Swift only or Swift optimized APIs and documentation.
     
  11. Dranix macrumors 6502a

    Dranix

    Joined:
    Feb 26, 2011
    Location:
    Gelnhausen, Germany
    #11
    I don't get all this Playground dominance in all talk on Swift. Yes Playgrounds are very, very buggy currently. But normal Swift usage is outside Playground in normal Xcode-targets...
     
  12. forcesteeler macrumors 6502

    Joined:
    Oct 1, 2007
    #12
    It will take Years Before Swift Takes over Objective C.

    I would compare Swift to when Microsoft switch over to C#Sharp from C++.

    C#Sharp Tooks Years before it become popular, plus a lot of developers still code in C++. A lot of Software Code Base is still in C++.
     
  13. firewood macrumors 604

    Joined:
    Jul 29, 2003
    Location:
    Silicon Valley
    #13
    C# was announced in 2000, reached 1.0 in 2002, but didn't rise above 3% percent popularity in usage until 2004, about four years after the announcement. (See TIOBE for details).

    My guess is that Swift usage will be above 3% usage before mid 2016, e.g. a much faster rise than C#.

    But Apple isn't even guaranteeing that current Swift code will be source code compatible with what comes out of beta. So you can't even write Swift code that won't break a few releases down the road. Wait a couple quarters.
     
  14. s2mikey macrumors 68020

    s2mikey

    Joined:
    Sep 23, 2013
    Location:
    Upstate, NY
    #14
    Yeah, it's not too bad. I'm about halfway through the Big Nerd ranch book on it and so far it's been mostly fine. Object access syntax without dot notation is a little dodgy and some of the ways of doing things is a little odd for me who's coming from developing in other, wordier languages.

    But, for some reason.... I'm liking Objective C overall. :)
     

Share This Page