{"action":"created","issue":{"url":"https://api.github.com/repos/facebook/componentkit/issues/149","labels_url":"https://api.github.com/repos/facebook/componentkit/issues/149/labels{/name}","comments_url":"https://api.github.com/repos/facebook/componentkit/issues/149/comments","events_url":"https://api.github.com/repos/facebook/componentkit/issues/149/events","html_url":"https://github.com/facebook/componentkit/issues/149","id":70631382,"number":149,"title":"Best way to remove cell from UICollectionView","user":{"login":"johanrydenstam","id":1712588,"avatar_url":"https://avatars.githubusercontent.com/u/1712588?v=3","gravatar_id":"","url":"https://api.github.com/users/johanrydenstam","html_url":"https://github.com/johanrydenstam","followers_url":"https://api.github.com/users/johanrydenstam/followers","following_url":"https://api.github.com/users/johanrydenstam/following{/other_user}","gists_url":"https://api.github.com/users/johanrydenstam/gists{/gist_id}","starred_url":"https://api.github.com/users/johanrydenstam/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/johanrydenstam/subscriptions","organizations_url":"https://api.github.com/users/johanrydenstam/orgs","repos_url":"https://api.github.com/users/johanrydenstam/repos","events_url":"https://api.github.com/users/johanrydenstam/events{/privacy}","received_events_url":"https://api.github.com/users/johanrydenstam/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-04-24T08:58:12Z","updated_at":"2015-04-24T13:41:24Z","closed_at":null,"body":"I'm trying to create a UICollectionView where each cell has a delete button. When the button is clicked the cell should be removed.\r\n\r\nThe UICollectionViewController knows which model that should be removed. But how can I know at which indexPath the model is represented? The ```CKCollectionViewDataSource```doesn't provide a method for enumerating the models. ```CKComponentDataSource``` does, and ```CKCollectionViewDataSource```wraps that class. It would be possible if ```CKCollectionViewDataSource```exposed it's wrapped data source.\r\n\r\nHow should this be done? Do I need to switch data source?"},"comment":{"url":"https://api.github.com/repos/facebook/componentkit/issues/comments/95935855","html_url":"https://github.com/facebook/componentkit/issues/149#issuecomment-95935855","issue_url":"https://api.github.com/repos/facebook/componentkit/issues/149","id":95935855,"user":{"login":"smiLLe","id":655296,"avatar_url":"https://avatars.githubusercontent.com/u/655296?v=3","gravatar_id":"","url":"https://api.github.com/users/smiLLe","html_url":"https://github.com/smiLLe","followers_url":"https://api.github.com/users/smiLLe/followers","following_url":"https://api.github.com/users/smiLLe/following{/other_user}","gists_url":"https://api.github.com/users/smiLLe/gists{/gist_id}","starred_url":"https://api.github.com/users/smiLLe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/smiLLe/subscriptions","organizations_url":"https://api.github.com/users/smiLLe/orgs","repos_url":"https://api.github.com/users/smiLLe/repos","events_url":"https://api.github.com/users/smiLLe/events{/privacy}","received_events_url":"https://api.github.com/users/smiLLe/received_events","type":"User","site_admin":false},"created_at":"2015-04-24T13:41:24Z","updated_at":"2015-04-24T13:41:24Z","body":"in theory  (though i never tried)\r\n- create nsarray of your models in your VC (ViewController)\r\n- pass your VC as a weak property in the context object to your DataSource\r\n- let the VC respond to a selector / use a protocol ( -deleteModelWithId:)\r\n- enqueue your models to fill your (ListView)\r\n- press the delete button in your component, call context.vc.deleteModelWithId:\r\n- deleteModelWithId removes model with given ID in the array\r\n- since you know the index in the array of the removed model you can enqueue a changeset as @aaronschubert0 mentioned"}}