Re: Put UICollectionView within UITableViewCell

2018-03-10 Thread Glen Huang
I’ll give it a shot, thank you very much > On 10 Mar 2018, at 10:27 AM, Cosmo Birch wrote: > > But you presumably know the width (i.e. the CollectionView width minus any > insets), and you can calculate the height based on that with NSString or > NSAttributedString

Using NSFetchedResultsController with many-to-many relationship

2018-03-10 Thread Glen Huang
Hi, I have two models: Person and Club. They have a many-to-many relationship. I want to display all people in a table view sectioned by clubs (which means there might be duplicate people across sections). I wonder how to do that with NSFetchedResultsController? NSFetchRequest never returns

Re: Using NSFetchedResultsController with many-to-many relationship

2018-03-10 Thread Steve Christensen
Don't complicate your life by managing multiple NSFetchedResultsControllers. Just create a single one that returns Club entities. For your table view data source methods: func numberOfSections(in tableView: UITableView) -> Int { return frc.fetchedObjects.count } func tableView(_ tableView:

Re: Using NSFetchedResultsController with many-to-many relationship

2018-03-10 Thread Quincey Morris
On Mar 10, 2018, at 13:06 , Steve Christensen wrote: > > Don't complicate your life by managing multiple NSFetchedResultsControllers. > Just create a single one that returns Club entities. The other valid approach, I think, is to “join” the two entities. That is, introduce a

Re: Using NSFetchedResultsController with many-to-many relationship

2018-03-10 Thread Glen Huang
Works like a charm. Thanks! > On 11 Mar 2018, at 6:03 AM, Quincey Morris > wrote: > > On Mar 10, 2018, at 13:06 , Steve Christensen wrote: >> >> Don't complicate your life by managing multiple NSFetchedResultsControllers. >> Just create