How you doing fellow developers?
I’m relatively new to iOS development and still struggling to implement what in other languages I do relatively easy.
I’m building an Events App. On my App, the user can choose which categories of events he wants to see everytime he runs the App. Sometimes according to some filters like [Date], certain categories may not have results to be shown. e.g.: He picked categories A, D, F, G and M. But for today, only D, F and M satisfies the criteria i.e. have Events to show.
So, the user preferences gives an Array of Categories (Sections). Each category should only be shown if the array of events (items in Section) for each category has at least one item. The problem is, In my UICollectionView I want to implement the numberOfSections and numberOfItemsInSection methods according to the above, with header titles, footer, etc.
Mentally I can go through the necessary logic to achieve that, like, return the count considering only those categories with at least one item. But I’m having troubles to translate it to swift code. How should I approach it? Can somebody share a code snippet implementing that?
Thanks in advance.