Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with rx_subscribeRowsToCellWithIdentifier #20

Closed
danielt1263 opened this issue May 27, 2015 · 3 comments
Closed

Problem with rx_subscribeRowsToCellWithIdentifier #20

danielt1263 opened this issue May 27, 2015 · 3 comments

Comments

@danielt1263
Copy link
Collaborator

func rx_subscribeRowsToCellWithIdentifier<E, Cell where E : AnyObject, Cell: UITableViewCell> (cellIdentifier: String, configureCell: (UITableView, NSIndexPath, E, Cell) -> Void) (source: Observable<[E]>) -> Disposable

I want to be able to configure my cells with structs, but since E must be an AnyObject I can't. Can that be changed to any?

@kzaher
Copy link
Member

kzaher commented May 27, 2015

Agreed, this should be fixed.

@kzaher kzaher added the bug label May 27, 2015
@alcarvalho
Copy link

I was trying to make this fix, but I stumbled on my lack of experience with Swift. After changing AnyObject to Any, I get the following error:

UICollectionView+Rx.swift:123:37: Cannot assign a value of type '[E]' to a value of type '[Any]'

If someone could help me, I would be happy to create a PR with the fixes. 😉

@kzaher
Copy link
Member

kzaher commented Jun 14, 2015

Hi Andre :)

Thnx for your interest in helping this project.

I've started to work on this problem before a couple of weeks. I have a solution here.

As you can see, it's not trivial because of the way swift generics interact with objective-c runtime, but should be really sweet to use it.

The reason why it's not merged yet into develop branch and into release pipeline is because I would like to add out of the box incremental updates in RxCocoa project for UITableView and UICollectionView.

The reason why I would like to do that is because I want to make sure that public interface makes sense for incremental updates also. I guess I could just design it so it makes sense, but proof by demonstration is best IMHO :)

Here are the ways how you can help us get this finished soon:

  • you can help me investigate partial design algorithm (I need to know how exactly do UITableView internals work). Although it looks like there is tons of information on the internet, all of the information is partial and lacking vital pieces.
  • after I finish changes for UITableView (maybe today or tomorrow), you can help me port those changes to UICollectionView. It should be pretty much analog to UITableView solution.
  • you can give me feedback on solution presented here https://github.com/kzaher/RxSwift/tree/feature/typed-data-source-and-sections, and suggest a better one :)

We can chat more about this in slack channel if you like :) #uitableview_interface

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants