为了方便使用,Foundation 为 iOS 开发中的几个常见操作提供了直接获取 Publisher 的方式。
URLSession PublisherTimer PublisherNotification PublisherKVO@Published
URLSession Publisher
这是 URLSession 新增的一种网络 API,通过这个 API 可以更加简单的完成网络请求数据转换等操作。
// 服务器返回的数据对应的Model
struct NewsModel: Codable {
var reason: String
var erro...