RxSwiftCommunity / RxTheme

Theme management based on Rx
MIT License
382 stars 29 forks source link

Why we can't bind more than 2 properties? #6

Closed tosbaha closed 6 years ago

tosbaha commented 6 years ago

Hi, If I do something like this

        themeService.bind([
            ({ $0.backgroundColor }, [self.rx.backgroundColor]),
            ({ $0.textLabelColor }, [self.textLabel!.rx.textColor]),
            ({ $0.detailTextLabelColor }, [self.detailTextLabel!.rx.textColor])
            ]).disposed(by: disposeBag)

Compiler gives me Type of expression is ambiguous without more context error. If I delete anyone of them, it compiles. Is it Swift bug or by design? What is the proper way to bind 3,4 properties all once instead of binding 2 or 1 at a time. Thanks.

wddwycc commented 6 years ago

@tosbaha This is a known issue for me, the compiler sometimes would consider the binding syntax as too complex. I'd prefer optimize it in the next version.

tosbaha commented 6 years ago

@wddwycc Thanks for the answer. I am looking forward to your next version.

wddwycc commented 6 years ago

@tosbaha Resolved in version2.0 with new chaining syntax