Skip to content

onReuseBag #181

Closed
Closed
@okla

Description

@okla

In readme example I see

repository.name
    .bindTo(cell.nameLabel.bnd_text)
    .disposeIn(cell.onReuseBag)

What is onReuseBag and where can I find it? And what if I use bnd_bag instead? Will it cause memory leak?

Activity

srdanrasic

srdanrasic commented on Oct 20, 2015

@srdanrasic
Contributor

That is something you need to create and dispose in prepareForReuse :)

class MyTableViewCell: UITableViewCell {
  let onReuseBag = DisposeBag()

  override func prepareForReuse() {
    onReuseBag.dispose()
  }
}

bnd_bag is automatically provided as an extension to NSObject and is disposed when object is deallocated.

okla

okla commented on Oct 20, 2015

@okla
Author

@srdanrasic got it, thanks!

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @ivanmoskalev@srdanrasic@okla

        Issue actions

          onReuseBag · Issue #181 · DeclarativeHub/Bond