当前位置: 首页 > news >正文

哪个网站可以做平面兼职电商网站开发工具

哪个网站可以做平面兼职,电商网站开发工具,短视频推广,怎么把自己做的网站放到百度上Combine 系列 Swift Combine 从入门到精通一Swift Combine 发布者订阅者操作者 从入门到精通二Swift Combine 管道 从入门到精通三Swift Combine 发布者publisher的生命周期 从入门到精通四Swift Combine 操作符operations和Subjects发布者的生命周期 从入门到精通五Swift Com…Combine 系列 Swift Combine 从入门到精通一Swift Combine 发布者订阅者操作者 从入门到精通二Swift Combine 管道 从入门到精通三Swift Combine 发布者publisher的生命周期 从入门到精通四Swift Combine 操作符operations和Subjects发布者的生命周期 从入门到精通五Swift Combine 订阅者Subscriber的生命周期 从入门到精通六Swift 使用 Combine 进行开发 从入门到精通七Swift 使用 Combine 管道和线程进行开发 从入门到精通八Swift Combine 使用 sink, assign 创建一个订阅者 从入门到精通九Swift Combine 使用 dataTaskPublisher 发起网络请求 从入门到精通十Swift Combine 用 Future 来封装异步请求 从入门到精通十一 目的使用 Combine 的管道来显式地对异步操作进行排序 这类似于一个叫做 “promise chaining” 的概念。 虽然你可以将 Combine 处理的和其行为一致但它可能不能良好地替代对 promise 库的使用。 主要区别在于promise 库总是将每个 promise 作为单一结果处理而 Combine 带来了可能需要处理许多值的复杂性。 任何需要按特定顺序执行的异步或同步任务组都可以使用 Combine 管道进行协调管理。 通过使用 Future 操作符可以捕获完成异步请求的行为序列操作符提供了这种协调功能的结构。 通过将任何异步 API 请求与 Future 发布者进行封装然后将其与 flatMap 操作符链接在一起你可以以特定顺序调用被封装的异步 API 请求。 通过使用 Future 或其他发布者创建多个管道使用 zip 操作符将它们合并之后等待管道完成通过这种方法可以创建多个并行的异步请求。 如果你想强制一个 Future 发布者直到另一个发布者完成之后才被调用你可以把 future 发布者创建在 flatMap 的闭包中这样它就会等待有值被传入 flatMap 操作符之后才会被创建。 通过组合这些技术可以创建任何并行或串行任务的结构。 如果后面的任务需要较早任务的数据这种协调异步请求的技术会特别有效。 在这些情况下所需的数据结果可以直接通过管道传输。 此排序的示例如下。 在此示例中按钮在完成时会高亮显示按钮的排列顺序是特意用来显示操作顺序的。 整个序列由单独的按钮操作触发该操作还会重置所有按钮的状态如果序列中有尚未完成的任务则都将被取消。 在此示例中异步 API 请求会在随机的时间之后完成作为例子来展示时序的工作原理。 创建的工作流分步表示如下 步骤 1 先运行。步骤 2 有三个并行的任务在步骤 1 完成之后运行。步骤 3 等步骤 2 的三个任务全部完成之后再开始执行。步骤 4 在步骤 3 完成之后开始执行。 此外还有一个 activity indicator 被触发以便在序列开始时开始动画在第 4 步完成时停止。 UIKit-Combine/AsyncCoordinatorViewController.swift import UIKit import Combineclass AsyncCoordinatorViewController: UIViewController {IBOutlet weak var startButton: UIButton!IBOutlet weak var step1_button: UIButton!IBOutlet weak var step2_1_button: UIButton!IBOutlet weak var step2_2_button: UIButton!IBOutlet weak var step2_3_button: UIButton!IBOutlet weak var step3_button: UIButton!IBOutlet weak var step4_button: UIButton!IBOutlet weak var activityIndicator: UIActivityIndicatorView!var cancellable: AnyCancellable?var coordinatedPipeline: AnyPublisherBool, Error?IBAction func doit(_ sender: Any) {runItAll()}func runItAll() {if self.cancellable ! nil { // 1print(Cancelling existing run)cancellable?.cancel()self.activityIndicator.stopAnimating()}print(resetting all the steps)self.resetAllSteps() // 2// driving it by attaching it to .sinkself.activityIndicator.startAnimating() // 3print(attaching a new sink to start things going)self.cancellable coordinatedPipeline? // 4.print().sink(receiveCompletion: { completion inprint(.sink() received the completion: , String(describing: completion))self.activityIndicator.stopAnimating()}, receiveValue: { value inprint(.sink() received value: , value)})}// MARK: - helper pieces that would normally be in other files// this emulates an async API call with a completion callback// it does nothing other than wait and ultimately return with a boolean valuefunc randomAsyncAPI(completion completionBlock: escaping ((Bool, Error?) - Void)) {DispatchQueue.global(qos: .background).async {sleep(.random(in: 1...4))completionBlock(true, nil)}}/// Creates and returns pipeline that uses a Future to wrap randomAsyncAPI/// and then updates a UIButton to represent the completion of the async/// work before returning a boolean True./// - Parameter button: button to be updatedfunc createFuturePublisher(button: UIButton) - AnyPublisherBool, Error { // 5return FutureBool, Error { promise inself.randomAsyncAPI() { (result, err) inif let err err {promise(.failure(err))} else {promise(.success(result))}}}.receive(on: RunLoop.main)// so that we can update UI elements to show the completion// of this step.map { inValue - Bool in // 6// intentionally side effecting here to show progress of pipelineself.markStepDone(button: button)return true}.eraseToAnyPublisher()}/// highlights a button and changes the background color to green/// - Parameter button: reference to button being updatedfunc markStepDone(button: UIButton) {button.backgroundColor .systemGreenbutton.isHighlighted true}func resetAllSteps() {for button in [self.step1_button, self.step2_1_button, self.step2_2_button, self.step2_3_button, self.step3_button, self.step4_button] {button?.backgroundColor .lightGraybutton?.isHighlighted false}self.activityIndicator.stopAnimating()}// MARK: - view setupoverride func viewDidLoad() {super.viewDidLoad()self.activityIndicator.stopAnimating()// Do any additional setup after loading the view.coordinatedPipeline createFuturePublisher(button: self.step1_button) // 7.flatMap { flatMapInValue - AnyPublisherBool, Error inlet step2_1 self.createFuturePublisher(button: self.step2_1_button)let step2_2 self.createFuturePublisher(button: self.step2_2_button)let step2_3 self.createFuturePublisher(button: self.step2_3_button)return Publishers.Zip3(step2_1, step2_2, step2_3).map { _ - Bool inreturn true}.eraseToAnyPublisher()}.flatMap { _ inreturn self.createFuturePublisher(button: self.step3_button)}.flatMap { _ inreturn self.createFuturePublisher(button: self.step4_button)}.eraseToAnyPublisher()} }runItAll 协调此工作流的进行它从检查当前是否正在执行开始。 如果是它会在当前的订阅者上调用 cancel()。resetAllSteps 通过遍历所有表示当前工作流状态的按钮并将它们重置为灰色和未高亮以回到初始状态。 它还验证 activity indicator 当前未处于动画中。然后我们开始执行请求首先开启 activity indicator 的旋转动画。使用 sink 创建订阅者并存储对工作流的引用。 被订阅的发布者是在该函数外创建的允许被多次复用。 管道中的 print 操作符用于调试在触发管道时在控制台显示输出。每个步骤都由 Future 发布者紧跟管道构建而成然后立即由管道操作符切换到主线程然后更新 UIButton 的背景色以显示该步骤已完成。 这封装在 createFuturePublisher 的调用中使用 eraseToAnyPublisher 以简化返回的类型。map 操作符用于创建并更新 UIButton作为特定的效果以显示步骤已完成。创建整个管道及其串行和并行任务结构是结合了对 createFuturePublisher 的调用以及对 flatMap 和 zip 操作符的使用共同完成的。 另请参阅 通过包装基于 delegate 的 API 创建重复发布者使用此代码的 ViewController 在 github 的项目中 UIKit-Combine/AsyncCoordinatorViewController.swift. 参考 https://heckj.github.io/swiftui-notes/index_zh-CN.html 代码 https://github.com/heckj/swiftui-notes
http://www.dnsts.com.cn/news/144101.html

相关文章:

  • 株洲网站开发公司电话北京视频网站建设
  • 自己电脑做网站服务器小工具如何设计一个网页步骤
  • 简速做网站工作室代销网站源码
  • dw建设网站教案企业展厅设计设计公司
  • 网站后台不能上传图片公司变更名字需要什么手续
  • php电子商务网站模板公司网站后台登陆
  • 免费建网站广告语本机运行wordpress
  • 广州企业网站seo上海门户网站的亮点
  • 衡阳做网站的公司博山信息港
  • 如何推广自己的外贸网站wordpress 当前页码
  • 浙江乐清新闻今天网络公司优化关键词
  • 在线a视频网站一级a做爰片平台推广计划
  • 深圳响应式网站免费网页模板源代码
  • 网站模板目录扫描成都网页设计美工培训
  • 什么网站管理系统好百度云盘官网登录入口
  • 模板生成网站页面设计的对称方法包括哪几种形式
  • 免费发布推广信息网站会用wordpress建站
  • 代做毕业设计网站徐州做网站的培训机构
  • 公司有些网站打不开江西萍乡做网站公司
  • 宝塔建设网站wordpress 去掉meta
  • 网站建设陷阱网站建设的常用软件有哪些
  • 中国做网站正邦沈阳市官网
  • 北京seo网站开发wordpress降低sql查询
  • jsp网站开发期末大作业怎么做一个网站
  • 济南网站优化技术厂家建设app下载官网
  • 路桥网站设计php图书管理系统网站开发
  • 电商建站应届生求职网站官网
  • 网站建设会提供哪些服务免费网站收录网站推广
  • 做网站的模板网站建设功能报价表
  • 网站开发实训安排国产erp软件前十名