Couple Swift questions

Discussion in 'Mac Programming' started by larswik, Jul 30, 2014.

  1. larswik macrumors 68000

    Joined:
    Sep 8, 2006
    #1
    I was a couple of things about the future of this new language. I did a couple of web searches and got mixed results.

    1. Will Objective C eventually be phased out meaning I need to re write all my old apps?

    2. With Objective C writing for IOS or OSX is slightly different. I am wondering if anyone knows if it will be the same now for both? For example string.text or string.stringValue.

    I am waiting to start Swift until it is officially released and not in the beta of of xcode.

    Thanks!
     
  2. SDDave2007 macrumors regular

    Joined:
    Apr 12, 2007
    #2
    1. probably not
    2. Yes... iOS uses UIxxx controls and OSX uses NSxxx controls.... or at least that is what I have seen so far.... basically the frameworks are different.
     
  3. xStep macrumors 68000

    Joined:
    Jan 28, 2003
    Location:
    Less lost in L.A.
    #3
    Although the UI frameworks have some similarities, they are different enough that they are not cross compatible between iOS and OS X. The iOS UI frameworks tend to be easier to deal with.

    The lower level frameworks are platform compatible. Occasionally you'll run across something you know about on one platform that isn't in the other. CIImage is one that comes to mind that has more options for OS X. For strings, you typically use NSString objects which I believe is identical between both systems. There are too many to list.
     
  4. larswik thread starter macrumors 68000

    Joined:
    Sep 8, 2006
    #4
    That I can see. But I am wondering / hoping that Swift will be universal for both. We shall see I guess.

    Thanks
     
  5. firewood macrumors 604

    Joined:
    Jul 29, 2003
    Location:
    Silicon Valley
    #5
    Not true. The programming language is identical. Some of the frameworks and data types within those frameworks are different. String is not a native Objective C data type. NSString is part of the Foundation framework, which is not part of Objective C, the programming language.

    One guess is that within 2 to 4 years, either Objective C or Swift will start being phased out, you can place your bets on which one. Which means you may have to rewrite either way you choose.
     
  6. xStep macrumors 68000

    Joined:
    Jan 28, 2003
    Location:
    Less lost in L.A.
    #6
    The languages will be universal. It's the frameworks that may have issues, especially UI stuff.
     
  7. firewood macrumors 604

    Joined:
    Jul 29, 2003
    Location:
    Silicon Valley
    #7
    Not "may", the frameworks are currently designed to be different, due to different UI paradigms (mouse vs. touch) and legacy APIs. Apple management (unlike Microsoft) has been talking against converging them. Who knows if/when that will change?
     
  8. xStep macrumors 68000

    Joined:
    Jan 28, 2003
    Location:
    Less lost in L.A.
    #8
    OK, I could have been more explicit on that response.
     
  9. briloronmacrumo macrumors 6502

    briloronmacrumo

    Joined:
    Jan 25, 2008
    Location:
    USA
    #9
    Only Apple knows and maybe not even them at this point in time. Anything else is speculation even on MacRumors. What we do know: Apple's warning system ( with deprecations etc. ) typically provides years of warning ( calls deprecated in 10.4 are still available in 10.9 and Carbon is still available ). Clearly Swift is still buggy and not released, so I won't use it for real work. I'd also like to see how Apple improves it before committing. Objective-C works and does everything I need ( and more ) and I don't want to write hybrid code ( i.e. writing Objective-C in Swift because Swift doesn't have that feature yet - NSSet comes to mind but there are others ). My guess, FWIW, is Swift will need a couple of years to mature and kill the obvious show-stopper bugs. At that point I'd look at it seriously.
    Again, only Apple knows where they are heading but the eventual consolidation of frameworks and UI seems possible. Among other things, Apple is a corporation driven by profits and lowering expenses. Maintaining two of everything is simply more expensive and likely to be on the current CEO's radar.
     
  10. firewood macrumors 604

    Joined:
    Jul 29, 2003
    Location:
    Silicon Valley
    #10
    Typically... however some APIs, such as uniqueIdentifier have been removed with less than a couple years of warning. Others simply stop working after a single upgrade in device OS and SDK required for submission (iOS 6 rotation delegates, UI tint colors, etc.).

    Driven by profits, yes. Lowering expenses, no. Around here they are hiring and constructing new office space on multiple sites like crazy. They currently seem to be driving profits by trying to increase customer value by more than they increase expenses. So what's the value to their customers of consolidating framework code used by developers? There is in some areas, but, at least according to their current public comments, not in all areas. They just increased the number of major programming languages for which they need massive support.
     
  11. Madd the Sane macrumors 6502a

    Madd the Sane

    Joined:
    Nov 8, 2010
    Location:
    Utah
    #11
    OpenTransport, which was ported over from Mac OS 9, started throwing deprecated warnings in 10.4, the headers (at least the atomic operations) were removed in 10.5, and said framework was removed in 10.9. Considering this, don't be surprised if QuickDraw is removed in 10.11 or 10.12, if it isn't in 10.10.

    Functions and classes that have been deprecated in 10.9 or later aren't available on Swift. A little disappointing, but Apple doesn't want people using deprecated functions.
     
  12. firewood macrumors 604

    Joined:
    Jul 29, 2003
    Location:
    Silicon Valley
    #12
    That said, even if Objective C starts being deprecated soon (the next WWDC), it won't be obsoleted too quickly, as Apple itself depends on a vast amounts of Objective C and C code (internal use stuff, as well as the more visible public frameworks and pro apps). Hopefully safe to use for iOS and OS X apps for at least another 3 or so years.
     
  13. Madd the Sane macrumors 6502a

    Madd the Sane

    Joined:
    Nov 8, 2010
    Location:
    Utah
    #13
    Not to mention the fact that, currently, Swift does not directly interact with C++ code, which some parts of CoreFoundation, Application Services, and related frameworks use (internally).
     

Share This Page