Managing an enum within a PFObject - iOS Swift/Parse -
i'm new parse , swift.
i have app people play against each other.
i want create activity feed game results, cheers, heckles (anything really) can show in list.
my thought create activity class subclasses pfobject , i'd have enum activitytype determine kind of activity being created.
can set activity object in parse , pfobject in swift each activity set correct activitytype?
my thinking need "type" column in parse that's number , init method reads number , sets correct type.
does sound right?
thanks
you use type column in parse, though i'd expect each of different kinds of feed item different classes in parse have different data , relationships, use class type (name).
in either case way identify type coming server. once have want organised , common approach displaying feed items. should have protocol defines feed item needs provide in order displayed on feed. have set of classes, each conforming protocol, , each dealing 1 of different types of feed item 'mutate' them common format display.
using enum in app work, lead have 1 big switch statement dealing everything. long use enum , switch deal deciding class create handle feed item code should structured.
Comments
Post a Comment