ios - Mapping Firebase lists to objects with Mantle -
i'm looking effective way map firebase lists custom objective-c objects mantle. firebase doesn't have concept of arrays, every item in list has explicit id. list in firebase of type event
appears this:
"events": { "id0": { "name": "event 1", "date": "2017-03-28t08:00:00+00:00", "venue": "venue 1" }, "id1": { "name": "event 2", "date": "2017-03-29t08:00:00+00:00", "venue": "venue 2" }, ... "id5": { "name": "event 6", "date": "2017-04-05t08:00:00+00:00", "venue": "venue 6" } }
in objective-c terms, translates nsdictionary, it's easier work nsarray in uitableviewcontroller. @ moment i'm using nsdictionary each event, , moving event's key inside dictionary , creating array of dictionaries follows (feel free comment on whether or bad idea):
{ "eventid": "id0", "name": "event 1", "date": "2017-03-28t08:00:00+00:00", "venue": "venue 1" }, { "eventid": "id1", "name": "event 2", "date": "2017-03-29t08:00:00+00:00", "venue": "venue 2" } ...
my idea create event
object:
@interface event: nsobject <mltmodel> @property (nonatomic, strong) nsstring *eventid; @property (nonatomic, strong) nsstring *name; @property (nonatomic, strong) nsdate *date; @property (nonatomic, strong) nsstring *venue; @end
so question this: there way map firebase list custom event
object mantle can used uitableviews in ios? specifically, how 1 map key (id0
, id1
etc) of firebase event property of custom event
object, , again? or better move key "manually" , hand on mantle?
Comments
Post a Comment