Objective C Core

Discussion in 'iPhone/iPad Programming' started by teguh123, Apr 4, 2011.

  1. macrumors member

    Joined:
    Mar 22, 2011
    #1
    This is a rough VB.net object I want to translate.

    Class Restaurant
    Public Property Title As String
    Public Property BuildingAddress As String
    Public Property Street As String
    Public Property Districts As Generic.List(Of String)
    Public Property City As String
    Public Property Country As String

    Public Property LatitudeLongitude As LatitudeLongitude
    Public Property Rating As Rating
    Public Property imageUrls As Generic.List(Of String)
    Public Property URLs As Generic.List(Of String)
    Public Property CurrentlyWorkedURL As String

    Public Property Reviews As Generic.List(Of Review)
    Public Property ZIP As String
    Public Property Categories As Generic.List(Of String)
    Public Property Phone As String
    Public Property Website As String
    Public Property Email As String
    Public Property Price As String
    Public Property openingHour As String
    Public Property Promotions As Generic.List(Of Promotion)
    Public Property SomethingWrong As Boolean
    Public Const ProfileFile As String = "profiles.txt"
    Public Shared Splitter As Char() = " ,.'()#-/&;""".ToCharArray
    Public Shared WordCount As Generic.Dictionary(Of String, Double)

    Now, the District relationship.

    Should I create an entity named District and then set up a one to many relationship between Restaurants and Districts?

    However, District is just a string. It's kind of cumbersome to create another entities whose type is NSString. Also is it possible since NSString is not decended from NSManagedObject.

    How to best implement attributes where one object can have many attributes.

    Think about Employee classes with one name and multiple aliases. How would you implement that in core?
     
  2. Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #2
    What is 'core'? Do you mean Core Data?
     
  3. thread starter macrumors member

    Joined:
    Mar 22, 2011
    #3
    Yes
     
  4. Moderator

    balamw

    Staff Member

    Joined:
    Aug 16, 2005
    Location:
    New England
    #4
  5. macrumors 68040

    Joined:
    Apr 22, 2005
    #5
  6. teguh123, Apr 6, 2011
    Last edited: Apr 6, 2011

    thread starter macrumors member

    Joined:
    Mar 22, 2011
    #6
    I read that and I think that's the wrong way to do it. I used coredata instead. I do not want to create all the classes from scratch.

    Actually this one is solved. My next quest is how to download data from the web and then populate that CoreData somehow
     

Share This Page