How Similar are OSX and iOS programing?

Discussion in 'Mac Programming' started by waynep, Mar 7, 2011.

  1. waynep, Mar 7, 2011
    Last edited: Mar 7, 2011

    waynep macrumors 6502

    Joined:
    Dec 31, 2009
    #1
    I am in my mid-40's and am a computer person. I have been doing some research but I have not seemed to answer this question yet. I used to teach COLBOL, C, BASIC at a community college. Professionally I have written in C, Unix Shell (ksh, sh, bash) and PERL.

    How similar is programming for OSX vs iOS? I know xcode is used for both.

    If I learn to write apps on iOS, how difficult would it be to write for OSX? I have xcode downloaded and am just starting to work through the Stanford iOS class. I am interested in creating a little side business. Maybe a free app to get started. Then maybe make enough to keep me funded with new hardware as needed.

    I also have a couple ideas for Mac programs. Utilities that I have found useful when I was a PC user that I can't find for the Mac.

    I am not asking how to get started, just curious if what I learn for iphone development is good for OSX also?

    I am looking at this book to help me with OOP: http://amzn.to/g79u43
     
  2. mydogisbox macrumors member

    Joined:
    Jan 16, 2011
    #2
    iOS and OSX programming are quite similar. A large portion of the APIs are shared and a significant portion of the rest is similar. As would be expected, the API for iOS is somewhat more limited than the OSX api.
     
  3. firewood macrumors 604

    Joined:
    Jul 29, 2003
    Location:
    Silicon Valley
    #3
    The UI frameworks are different, but use very similar concepts and conventions. Some OS calls are missing (or prohibited) in the iOS version. But the Objective C language and the XCode tools are identical.

    So you can't take UI code for one and run it on the other, but you can write two parallel versions that will be very similar.
     
  4. whooleytoo macrumors 603

    whooleytoo

    Joined:
    Aug 2, 2002
    Location:
    Cork, Ireland.
    #4
    Your model classes (classes for storing/representing data) should be more or less identical for both.

    As for the rest, it depends on what kind of app you're writing. Many iOS apps are based around UITableViews, and the equivalent in OSX (NSTableView) is very similar to use, so once you get one working, doing to on the other platform will be very easy.

    But of course, you don't simply want to create a clone of an iOS app on OSX, or vice versa. You'd typically expect an iOS app to have a simpler, cleaner UI than a similar app on OSX, and a lot of the porting/cross-platform development time could be just on these differences.
     
  5. ulbador macrumors 68000

    ulbador

    Joined:
    Feb 11, 2010
    #5
    I started off with iOS programming and then went back to OSX programming. I found the transition to be a little difficult at some places.

    Although very similar, often the iOS manner of accomplishing something is greatly simplified from the OSX way of doing it. In many cases I imagine it would be much easier to go from OSX to iOS than the other way around.
     
  6. PatrickCocoa macrumors 6502a

    Joined:
    Dec 2, 2008
    #6
    Almost the same

    iOS and MacOS programming are very similar. I've programmed in both.

    Same:
    - Development environment (Xcode / Interface Builder on a Mac)
    - Language (Objective - C)
    - Distribution (now that Mac has its own App Store)

    Different:
    - APIs (Cocoa vs. Cocoa Touch). These are very similar, except where they're different (!). For example Cocoa Touch UI is focused on tables views and switching in and out full screens. But there is a great deal of overlap (say hello to NSString, NSArray, etc.).
     
  7. waynep, Mar 8, 2011
    Last edited: Mar 8, 2011

    waynep thread starter macrumors 6502

    Joined:
    Dec 31, 2009
    #7
    Since I don't know Obj-C or Object Oriented concepts, due to my programming experience being in C, COBOL, BASIC, Pascal . . . I bought this book: http://amzn.to/hv4b1c and am working through the examples and exercises while reading it.

    Once finished, this one will be next: http://amzn.to/grY58s and I might go through the Stanford iTunesU course for IOS development.

    Then I'll tackle a project that I have an idea for on OSX. Is this a good OSX book? http://amzn.to/eWQaiv Is this good or is it dated? Better one?

    Thanks for input everyone!

    Wayne
     
  8. ulbador macrumors 68000

    ulbador

    Joined:
    Feb 11, 2010
    #8
    That's one of the top recommended books. The author is also a MR member, though I don't know that he's been active lately (search for skochan)
     
  9. firewood macrumors 604

    Joined:
    Jul 29, 2003
    Location:
    Silicon Valley
    #9
    That makes perfect sense, as Mac OS X apps very often include things that iOS apps don't, such as the menu bar and menu events, multiple windows and window events, mouseover vs. click/tap events, cursor key events, keydown vs. text input events, etc. Plus there are other optional capabilities such as launching processes, inter-app communication, access to USB devices, etc., available.

    Going the other way isn't trivial either. Besides the obvious UI redesign for a much smaller single window, view switching within that one window, no mouse-over events, etc. one has to make sure the app fits in the constrained memory and runs fast on a lower power CPU, build ones own controller classes, properly handle app suspend, activate, low memory warning delegates, etc.
     
  10. hubrisForAll macrumors newbie

    Joined:
    Jan 13, 2011
    Location:
    Houston
    #10
    Hi. I've only recently started programming so this will either be very helpful or misleading :)

    I tried to start directly with the BNR Iphone programming book you plan on using second but found myself not quite ready for it, having only basic PHP experience. I then went to Kochan's which, while good, I found a little too slow - it seemed meant for people with no experience at all. Post-kochan, I actually picked up Hillegass' OSX book "Cocoa Programming for Mac OS X", which is almost universally recommended. Overall I thought it was fantastic and got me familiar with a huge amount of concepts relatively quickly. It also seemed a bit better written (being further down the edition line) than its BNR iPhone counter-part.

    I decided to chime in since I can only imagine you to be in a somewhat similar (though more advanced) situation - solid C, but no OOP experience. That being said, if you find yourself non-engaged with Kochan, I'd recommend jumping to Hillegass.

    http://www.amazon.com/Cocoa-Program...=sr_1_2?s=books&ie=UTF8&qid=1299619316&sr=1-2
     
  11. waynep thread starter macrumors 6502

    Joined:
    Dec 31, 2009
    #11
    I meant to put the link to that book in my above question. So it's one I am looking at. Thanks!
     
  12. Blakeasd macrumors 6502a

    Joined:
    Dec 29, 2009
    #12
    The things you learn about the objective-c language will remain the same. The frameworks you sill be using are different however. In IOS you commonly use UIKit while in OSX you use AppKit. Once you have your iOS app written search google for information on porting the code over.
     
  13. chrono1081 macrumors 604

    chrono1081

    Joined:
    Jan 26, 2008
    Location:
    Isla Nublar
    #13
    I'm not sure if this was mentioned, I didn't see it but in OSX you can use garbage collection where in iOS your memory has to be managed manually.

    (Yes I know there are little stipulations with what I just said but for the most part its true).
     

Share This Page