Can I subscribe to be notified when a property getter is called, using ReactiveCocoa?

I need to set a flag that certain data needs to be updated (via network request) in the near future, because someone accessed it.

有帮助吗?

解决方案

I don't know why you'd want to do this, I'd really suggest posting a question that asks what the best way to solve the problem you're seeking to solve. But, yes it's theoretically possible to do what you're asking, using -rac_signalForSelector:.

[[object rac_signalForSelector:@selector(property)] subscribeNext:^(id value) {
    // Getter has been called
}];
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top