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

Popular posts from this blog

javascript - gulp-nodemon - nodejs restart after file change - Error: listen EADDRINUSE events.js:85 -

Fatal Python error: Py_Initialize: unable to load the file system codec. ImportError: No module named 'encodings' -

javascript - oscilloscope of speaker input stops rendering after a few seconds -