Skip to content
This repository has been archived by the owner on Dec 5, 2019. It is now read-only.

View model observing itself #6

Closed
kastiglione opened this issue Sep 9, 2013 · 4 comments
Closed

View model observing itself #6

kastiglione opened this issue Sep 9, 2013 · 4 comments
Labels

Comments

@kastiglione
Copy link
Member

In order to do validation, I'm creating an isValid signal property on the view model. The signal is created the usual way with -combineLatest:reduce: with the input signals being RACObserve(self, propertyNameX). It seems strange to be observing self, but it also seems to be a necessary approach. Is this the way to do it, or is there a better way?

EDIT: Related to #2.

@jspahrsummers
Copy link
Member

We observe self all the time. I don't see any problem with it in theory or practice.

Why do you feel like it's strange?

@kastiglione
Copy link
Member Author

Yeah, I figured it was just me. I say "strange" because I've always known observing as technique for external objects to employ. Observing self feels like speaking of oneself in the third person. It's not that I thought there would be problems. Thanks for confirming.

@jspahrsummers
Copy link
Member

I think it's comparable to subscribing to a signal on self, since properties are signals under RAC.

@kastiglione
Copy link
Member Author

That is a helpful perspective.

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

No branches or pull requests

2 participants