Recommendations for learning Xcode and Git

Discussion in 'iOS Programming' started by Greencardman, Oct 16, 2012.

  1. Greencardman macrumors 6502

    Joined:
    Apr 24, 2003
    Location:
    Milwaukee, WI
    #1
    What are some useful resources for learning Xcode and/or Git? Any book recommendations?

    We use an open source back-end to produce our magazine and I've self-taught myself enough programming to get by and get our app in the App Store. I have trouble understanding what everything does in Xcode and I mess up often, which breaks our app, so I'm terribly afraid of touching things.

    I also make little changes to the code here and there, like adding analytics, and then a new version of the open source code comes out and I have to go over my old code line by line to find out where I should copy and paste the bits that I added. This is unsustainable, so I'd like to learn how to manage my code so that I can merge two files, again, without breaking our app.

    I don't need any books on programming, just Xcode and how things work. So what have you guys found useful?
     
  2. CodeBreaker macrumors 6502

    Joined:
    Nov 5, 2010
    Location:
    Sea of Tranquility
    #2
    1. Disable Xcode's built in source control. It is PITA
    2. Use git flow (https://github.com/nvie/gitflow)
    3. If you are using third party libraries which have their own git, then to keep them updated, just add them as submodules to your git
     
  3. dejo Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #3
    Care to elaborate as to why you think Xcode's built-in source control is a PITA and how gitflow helps?
     
  4. CodeBreaker macrumors 6502

    Joined:
    Nov 5, 2010
    Location:
    Sea of Tranquility
    #4
    I've had huge issues with Xcode in the past. It used to lose code whenever you changed a branch or created a new one. For small projects it may not be a big hassle, but for larger projects, a few missing lines can lead to big problems. Also, it used to crash many times while auto-merging.

    Git flow is just an alternate git branching model. In git flow, there are only two branches in your repo: one on which you do your regular development (develop) and the other which only contains stable code (master). When you start working on a new feature, you create a new branch for it based on the develop branch. After you are done with the feature, you commit your changes and merge the branch into develop. And when you have release worthy code, you merge the master and develop branches.

    Other than these there are also hot fix branches and release branches. The main advantage is that implementing a new feature does not break other things. It also becomes easy to track which feature was implemented in which commit and dig out the code for a specific release.

    You can read more here:
    http://jeffkreeftmeijer.com/2010/why-arent-you-using-git-flow/
     
  5. Greencardman thread starter macrumors 6502

    Joined:
    Apr 24, 2003
    Location:
    Milwaukee, WI
    #5
    I'm very frustrated with Xcode's documentation right now. For a beginner, its kind of confusing. I need to merge two documents, neither one of which I coded. When it puts them up on the screen side by side, I don't even know which one is which. How do I pick the lines I want to keep or the ones I want to remain the same. Am I just not getting the concept here?
     
  6. Sykte macrumors regular

    Joined:
    Aug 26, 2010
    #6

    Learn git outside of Xcode first. I would recommend code school or the tutorial on Github. Do not learn git via any type of UI or it will seem awkward. Then come back to Xcode and try it again. I learned git before Xcode supported it and found it an easy transition.


    On a conflict or a regular commit? If it's a regular commit you select the files to commit on the left vertical bar. If you want to discard specific lines you do so with the numbered buttons located in the vertical bar that separates the left document (which reflects the changes you have made since the last commit) and right document (reflects the document at the last commit).
    Hope this helps.
     
  7. moral-hazard macrumors regular

    Joined:
    Jul 27, 2009
    Location:
    Palo Alto, CA
    #7
    A good investment here might be to read up about how to write tests for your application. The app I'm working on has a "model" component which is somewhat involved mathematically and very core to the application. One way I worked around the same concerns you mention was to write exhaustive unit tests to ensure that any change I makes preserves the important properties / requirements of those classes. On a higher level, I would assume that you can also write automated front-end tests where you could basically specify an entire user workflow, and have the test walk through it step by step. This is another good way to ensure that changes you make don't present any regressions in functionality. :)
     

Share This Page