Objective C Core

Discussion in 'iOS Programming' started by teguh123, Apr 4, 2011.

  1. teguh123 macrumors member

    Mar 22, 2011
    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. dejo Moderator


    Staff Member

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

    Mar 22, 2011
  4. balamw Moderator


    Staff Member

    Aug 16, 2005
    New England
  5. admanimal macrumors 68040

    Apr 22, 2005
  6. teguh123, Apr 6, 2011
    Last edited: Apr 6, 2011

    teguh123 thread starter macrumors member

    Mar 22, 2011
    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