- December 27, 2020
- December 26, 2020
Introduction to Combine | Supporting Combine in a custom class
Combine is a framework to implement asynchronous operations. It is created by Apple, it is also used in Swift Data Binding. It is an important framework. If you new to Combine, see next article. If you want other samples, see following articles. This article explains how to support Combine in a custom class. Adopt to ObservableObject protocol. To make a class to support Combine, adopt to ObservableObject protocol. To notify a changes of properties with Combine, mark the property with @Published attribute. class PlayerStatus : ObservableObject { @Published var name: String = "" @Published var hitPoint: Int = 100 } […]