当前位置:网站首页>RxSwift --(1)创建一个项目
RxSwift --(1)创建一个项目
2022-06-28 04:31:00 【JH_Cao】
一、RxSwift简介
- Rx 是通过接口表示的计算的通用抽象,它允许您从流中Observable广播和订阅值和其他事件。Observable
RxSwift 是响应式扩展标准的特定于 Swift 的实现。 - 简单来说,就是把一般的Swift事件,全部转换为流事件,可以监听事件
二、Demo
- 传统的点击事件
override func viewDidLoad() {
super.viewDidLoad()
wechatBtn.addTarget(self, action: #selector(clickBtn(_:)), for: .touchUpInside)
}
@objc
func clickBtn(_ sender: UIButton) {
print("点击了")
self.navigationController?.pushViewController(WeChatViewController(), animated: true)
}
- RxSwift的点击事件
func addEvent() {
wechatBtn.rx.tap.subscribe { (_) in
self.navigationController?.pushViewController(WeChatViewController(), animated: true)
}.disposed(by: sharedDisposeBag)
}
边栏推荐
- Notepad++ -- common plug-ins
- 论文详读:IMPROVING CONVOLUTIONAL MODELS FOR HANDWRITTEN TEXT RECOGNITION
- 一文详解|增长那些事儿
- Standard particle swarm optimization C language program
- [NOIP2002 普及组] 过河卒
- Matlab exercises -- exercises related to symbolic operation
- Why are cloud vendors targeting this KPI?
- [proteus simulation] timer 1 external counting interrupt
- 2022年低压电工考题及答案
- Differences between pragma and ifndef
猜你喜欢

Flexible IP network test tool -- x-launch

Generate QR code in wechat applet

控制器的功能和工作原理

The growth summer challenge is coming | learn and create two major tracks, and start the tutor registration!

Excel knowledge and skills summary

Mask's miserable and inspirational childhood, who is introverted by campus violence

Ppt production tips

JVM I: introduction to JVM and understanding of class files

测试开发必备技能:安全测试漏洞靶场实战

Congratulations to myself, official account has more than ten thousand fans
随机推荐
Moonbeam integrates coin98, giving users more choices on the multi chain road
Light collector, Yunnan Baiyao!
xml  File read / write
Are test / development programmers really young? The world is fair. We all speak by strength
[Matlab bp regression prediction] GA Optimized BP regression prediction (including comparison before optimization) [including source code 1901]
快速下载JDK,除了官方Oracle下载,还有国内可以有最新版本的下载地址吗
The coming wave of Web3
Play with double pointer
100+数据科学面试问题和答案总结 - 机器学习和深度学习
Pager when importing text files from MySQL
判断对象中是否存在某一个属性
Is it true that qiniu business school gives away securities accounts? Is it safe to open an account
mysql----where 1=1是什么意思
整理网上蛋糕商城项目
native关键字的作用
Multithreading and high concurrency six: source code analysis of thread pool
How to traverse collections Ordereddict, taking it and forgetting items
100+ data science interview questions and answers Summary - machine learning and deep learning
Analyse complète annuelle du marché chinois de l'audio en 2022
Function and working principle of controller