Boon
Boon

Reputation: 41480

ReactiveCocoa replayLast: + take:1

I came across a code snippet in ReactiveCocoa 2 that uses the combination of replayLast and take:1. Given that replayLast returns one element only, is take:1 redundant?

[[[[ ... ] replayLast] take:1] switchToLatest];

Upvotes: 1

Views: 77

Answers (1)

NachoSoto
NachoSoto

Reputation: 1743

It's not redundant: replayLast will start replaying the last element, but it will continue emitting any subsequent values after the initial one.

Upvotes: 1

Related Questions