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

Need add associatedtype ViewModel #4

Open
netcosportsanatoly opened this issue Jul 14, 2020 · 2 comments
Open

Need add associatedtype ViewModel #4

netcosportsanatoly opened this issue Jul 14, 2020 · 2 comments

Comments

@netcosportsanatoly
Copy link

Now all DisposableBindable require to declare ViewModel type

With adding associatedtype ViewModel it will be detected automatically from func bind(viewModel: ViewModel, with bindDisposeBag: DisposeBag) implementation

func bind(viewModel: ViewModel, with bindDisposeBag: DisposeBag)

@sergeimikhan
Copy link
Contributor

public protocol Bindable {

  init()

  associatedtype ViewModel // here it is.
  func bind(viewModel: ViewModel)
}

public protocol DisposableBindable: Bindable & BindableDisposeBagContainer {

  func bind(viewModel: ViewModel, with bindDisposeBag: DisposeBag)
}

Not sure I got a point.

@netcosportsanatoly
Copy link
Author

netcosportsanatoly commented Jul 15, 2020

It should be:

public protocol Bindable {

  init()

  associatedtype ViewModel
  func bind(viewModel: ViewModel)
}

public protocol DisposableBindable: Bindable & BindableDisposeBagContainer {

  associatedtype ViewModel // and here too
  func bind(viewModel: ViewModel, with bindDisposeBag: DisposeBag)
}

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

No branches or pull requests

2 participants