intuit / CardParts

A reactive, card-based UI framework built on UIKit for iOS developers.
Other
2.52k stars 225 forks source link

Use of unresolved identifier Variable("") #117

Closed thunpisit closed 5 years ago

thunpisit commented 5 years ago

I'm new to CardParts and I'm playing with it to implement it to my app. For some reason, my Xcode does not recognize Variable("") and yelling Use of unresolved identifier Variable("")

var title = Variable("")
var text = Variable("")

init() {

    // When these values change, the UI in the TestCardController
    // will automatically update
    title.value = "Hello, world!"
    text.value = "CardParts is awesome!"
}
lwdupont commented 5 years ago

You might be missing doing:

import RxSwift import RxCocoa

CardParts includes that as a dependency in the Cocoapods spec, but you do need to include it if you are going to use it in a (what looks like) a subclass.

thunpisit commented 5 years ago

@lwdupont Thank you so much, that eliminate the problem with variable but now I am facing another problem which yelling: Value of type 'CardPartTextView' has no member 'reactive' on each of these both lines.

    viewModel.title.asObservable().bind(to: titlePart.reactive.title).disposed(by: bag)
    viewModel.text.asObservable().bind(to: textPart.reactive.text).disposed(by: bag)
croossin commented 5 years ago

@thunpisit Whoops! It seems that the README has some old code in it... Instead of titlePart.reactive.title it should be titlePart.rx.title! Thanks for that catch and I will go ahead and update the README.

croossin commented 5 years ago

Have merged PR #121 - thanks again for the catch @thunpisit !

croossin commented 5 years ago

Fixed by version 2.7.5.