课程: Learning Combine with Swift

今天就学习课程吧!

今天就开通帐号,24,100 门业界名师课程任您挑!

Understand the Combine life cycle

Understand the Combine life cycle - Swift教程

课程: Learning Combine with Swift

Understand the Combine life cycle

- [Instructor] It helps to take a birds-eye view of the Combine lifecycle so that you can understand how each of the actors interacts, the sequence of events, what comes before what. Let's get those answers for you and set the foundation for the remainder of the course. So we have a subscriber and a publisher. Say the publisher asynchronously calls a URL and returns data. The subscriber first subscribes to that publisher, which in turn creates a subscription that is given back to the subscriber. With the subscription in place, the subscriber can then request values from the publisher, tapping into a stream of events being returned from the publisher. Now, all subscribers conform to the cancelable protocol, allow them to cancel the subscription if there are no subscribers left. The publisher terminates as well. Sub-publishers, if defined so, could also emit a completion or failure signal causing the subscription…

内容