M
M
Max Onflic2014-07-04 18:32:48
Objective-C
Max Onflic, 2014-07-04 18:32:48

What is the best way to filter NSSDictionaty?

Actually, this schedule is being parsed - www.bsuir.by/psched/rest/160801, the group may vary ( www.bsuir.by/psched/schedulegroup). As a result, I drive a lot of NSArray into NSDictionary , in which NSDictionary is again stored, which already contains the necessary information by key ("teacher" for example). It is necessary to filter the entire main NSDictionary by 3 stages that decrease by filtering ranking:
-day of the week
- current week (in the university, the countdown of weeks starts from September 1, and this par is set by the user)
-subgroup (again by the user).
What is the best way to organize an entity that will produce the necessary information at the output?
I have already made an option where everything is filtered by ranking, a lot of code is repeated and there is a lot of it, which is disgusting.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
K
kaspartus, 2014-07-04
@maxonflic

I so understood that basically a question on a subject of a choice of structure of entities. To do this, it would be nice to see the requests themselves. The simplest is to keep a Subject object with the fields: Title, Instructor, Room/Location, Start Time, Duration.
I would directly bind to the essence of the base (MagicalRecord will do an excellent job with this task), and then we filter it.
Regarding filtering, as @morozovdenis wrote , the NSPredicate class is used.
Separately, I’ll add that any framework / lib for working with databases already probably has built-in filtering and sorting capabilities, just go over any tutorial / docs.

D
Denis Morozov, 2014-07-04
@morozovdenis

according to the links, I have errors
parsing into typed objects (just objects or CoreData) and it is already easier to filter them from different sides (NSPredicate)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question