1

Is there some kind of Computed Observable in ReactiveKit Or Bond?

Does initializing an Observable with a native Swift computed property will act the same?

Dorad
  • 3,413
  • 2
  • 44
  • 71

1 Answers1

0

I have implemented it like this:

class Person {
    var firstName: String
    var lastName: String
    private var fullNameBG: Observable<String>
    var fullName: Observable<String> {
        computedPropBG.next("\(firstName) \(lastName)")
        return computedPropBG
    }
    init() {
        fullNameBG = Observable("")
    }
}

Will be glad to hear a better solution.

Dorad
  • 3,413
  • 2
  • 44
  • 71
  • It feels to me that you can use MVP or MVVM pattern to create an additional layer with observables. – Shmidt Mar 12 '18 at 15:52