You can watch this episode by subscribing to Cocoacasts Plus.

Building Reactive Applications With Combine

Managing Subscriptions

Download Your Free Copy of
The Missing Manual
for Swift Development

The Guide I Wish I Had When I Started Out

Join 20,000+ Developers Learning About Swift Development

Download Your Free Copy

In the previous episode, you learned about publishers and subscribers. Combine creates a subscription when a subscriber is attached to a publisher. In the setupNotificationHandling() method of the RootViewModel class, the subscription is returned to the view model as an AnyCancellable instance. The view model holds on to the AnyCancellable instance to prevent the subscription from terminating early. We covered this in the previous episode.

Instant and Unlimited Access
to 400+ Cocoacasts Tutorials

Monthly

$19 / month

Pay Once a Month
30 Day Money Back Guarantee

Yearly

$8.25 / month (billed annually)

Pay Once a Year and Save $129
30 Day Money Back Guarantee
Access to All Books

Next Episode "Adding Operators to the Mix"