Possible to create simple app with Core Data + Interface Builder?

Discussion in 'Mac Programming' started by Zearin, Aug 11, 2008.

  1. Zearin macrumors newbie

    Joined:
    Aug 11, 2008
    Location:
    Eastern U.S.
    #1
    Hello,

    I have an odd request. I want to know if it is possible to make a simple app that lets me have basic CRUD functionality (Create Read Update Delete) using just Core Data and Interface Builder. If some light coding is required, I might be able to figure it out with some tampering, although I don't know Objective-C.

    Some quick background:
    • I'm familiar with the concepts of OO programming, and acquainted with design patters in general (most familiar with MVC), although I have rarely put them to practice because…
    • I got into programming starting with hand-coding web-pages, and then some PHP. Throw in a Java class, and that's how I learned OOP.
    • I love that stuff, but these days I spend most of my dev work with XML + XSL. It's really bizarre stuff, but I love what I can do with it. Unfortunately, it has successfully kept me from learning other things. :)
    • I love diagrams. Pictures really help me understand stuff much faster than reading specs. I totally love how the modelling tool in Core Data works, and I'm totally comfy with using it.
    • I know how to play around in Interface Builder and that each little bit has a bunch of stuff you can configure in the inspecture. However, knowing how to connect all that stuff together with the model is where I'm weakest. I've read tutorials and the official documentation, but they all are generalized to accomodate any possible app someone might be writing. I just want a simple thing with a side panel that lets me make groups and display them in a table on the right, sort of iTunes-ish but just for arbitrary data that I would model using Core Data.

    So, I can totally model exactly what I want, and build the GUI to what I want. Is it possible to get them to connect writing minimal or no code? How to go about this without using more than I need?
     
  2. HiRez macrumors 603

    HiRez

    Joined:
    Jan 6, 2004
    Location:
    Western US
    #2
    It sounds like something that should be doable with minimal coding. You will, however, have to use and understand Cocoa Bindings to make it work mostly from Interface Builder, as well as the Xcode modeling tool.

    Have a look at the Cocoa Dev Central Core Data tutorial, it does something very simililar to what you are looking for I think. Unfortunately there is bound to be something that pops up you'll want to add that forces you into a bit of code.
     
  3. Zearin thread starter macrumors newbie

    Joined:
    Aug 11, 2008
    Location:
    Eastern U.S.
    #3
    Cocoa Dev Central Tutorial

    Yep, I did read that tutorial already (and a couple of others at that site, also). They are some of the best tutorials I've ever seen—well illustrated, clearly written, very step-by-step.

    Unfortunately, the exact thing that I'm trying to learn is something that has changed since those tutorials were written. I.E., they were written for XCode/IB 2, and I have XCode/IB 3, and there are some drastic changes between those versions that keep me from following the tutorials, no matter how well-crafted they are. :(
     
  4. lucasgladding macrumors 6502

    Joined:
    Feb 16, 2007
    Location:
    Waterloo, Ontario
    #4
    Where are you running into problems? I imagine that IB3 is the big difference here. That said, not much has changed from these tutorials. The IB library palette now has a Core Data Entity object. You just use that object instead of dragging from the model in Xcode into IB. The bindings are set up the same way as they are under IB2, the palette just looks a little nicer :) .
     
  5. Zearin thread starter macrumors newbie

    Joined:
    Aug 11, 2008
    Location:
    Eastern U.S.
    #5
    Yeah, IB3 is what's messing me up mostly.

    I'm confused about how controllers delegate to one another, and what is actually happening in detail when CTL+dragging between things. (I know this is for creating outlets as well as other things, but when does it do one operation or the other? And when does it matter which item you start at or not?)

    I'm also a little confused about the difference between Bindings and Connections. In “connections” there's stuff for outlets*…*but doesn't Bindings cover (among other things) outlets? It seems there is at least a little overlap, but I'm not sure if they are different ways of accomplishing the same thing, or if they do different things and should be used together…

    Again, I've poked around the official IB documentation, but it's not written for someone who's trying a quick "get in, get out" app like I want to do. I'm not even sure it's possible, but if it is I sure would like to try.
     
  6. Sayer macrumors 6502a

    Sayer

    Joined:
    Jan 4, 2002
    Location:
    Austin, TX
    #6
    The books should at least explain what you are doing by connecting outlets and actions in IB.

    Outlets are one way, away from the object. Actions are called on the object (in) from another object or UI element.

    Bindings are like little scripted versions of actions and outlets that automatically send data to outlets or set up objects with certain values.

    You can learn that stuff easily, but the differences in IB 2 and 3 aren't so insurmountable if you already know what you want to do.
     
  7. Zearin thread starter macrumors newbie

    Joined:
    Aug 11, 2008
    Location:
    Eastern U.S.
    #7
    Interesting…so, is this correct?

    outlets = Object → View
    actions = [View | OtherObject] → Object

    (where “Object” is usually a controller?)​

    Hmm.

    If I were to use Bindings, does that eliminate the need for Outlets and Actions? (Since Bindings is supposed to automatically keep the View & Model in sync…) Remember I'm not trying anything complex. Just basic CRUD functionality.

    “if you already know what you want to do”
    I don't. (At least not the technical steps involved.) That's why I posted here. :)
     
  8. HiRez macrumors 603

    HiRez

    Joined:
    Jan 6, 2004
    Location:
    Western US
    #8
    Outlets can be any object, not just views (although views are objects too).

    Actions send a message to the target object when triggered by a certain action on the source object (like the user clicking the mouse on a button).

    Using Bindings won't eliminate the need for outlets, connections, and actions, although it can cut down on the number of those. In your basic CRUD app, most of the connections will be to an array controller object that is bound to the managed object context (your Core Data objects). You'll need to wire up various things to this controller object, for example an "Add" button clicked might send a message to the array controller to add a new object (record), or a "Delete" button clicked might send a message to remove the currently selected one. You'll use Bindings which are bound to the array controller to display the data in table columns and text views.
     
  9. TimFReilly macrumors newbie

    Joined:
    Aug 25, 2008
    #9
    Is there a way to import the nib in the tutorial when 3.1 seems to use xib? I'm new to Xcode. :)
     
  10. lee1210 macrumors 68040

    lee1210

    Joined:
    Jan 10, 2005
    Location:
    Dallas, TX
    #10
    Put this in a new thread, it is not on topic. If you have a thread that describes what you're trying you're more likely to get replies.

    -Lee
     
  11. TimFReilly macrumors newbie

    Joined:
    Aug 25, 2008
    #11
    The responses in the thread were often about the tutorial mentioned and using it in newer versions of XCode.

    My reasoning was, if I had made a new thread, someone could have just as well have said "you should have just put this in the old thread instead of making new ones". Hopefully that makes sense. :)
     

Share This Page