RxSwiftCommunity/RxGesture
RxSwift reactive wrapper for view gestures
🖱️ RxGesture: Gesture recognizer thành luồng RxSwift
RxGesture biến gesture recognizer thành Observable, subscribe như các sự kiện thường ngày.
RxGesture là thư viện RxSwift cộng đồng cung cấp wrapper reactive cho gesture recognizers trên iOS và macOS. Thay vì bắt sự kiện delegate phức tạp, bạn subscribe trựctiếp vào tap, swipe, pan, pinch, rotation... và nhận recognizer đã đầy đủ thông tin vị trí, dịch chuyển.
✨ Điểm nổi bật
- Single gesture API:
view.rx.tapGesture(),.panGesture(),.swipeGesture(.left)... trả vềControlEventkiểu subclass tương ứng. - Multi-gesture API:
view.rx.anyGesture(.tap(), .swipe([.up, .down]))gộp nhiều recognizer thành một stream. - Tuple filtering:
anyGesture((.tap(), when: .recognized), (.pan(), when: .ended))lọc state riêng cho từng recognizer. - State filtering:
.when(.recognized),.when(.began, .changed, .ended)lọc theo trạng thái gesture. - Concrete type:
rx.fooGesture()trả về subclass cụ thể, tránh cast trong subscribe. - Cross-platform: hỗ trợ gesture recognizers riêng cho iOS (
UI*GestureRecognizer) và macOS (NS*GestureRecognizer). - Delegate policy: tùy chỉnh delegate method qua policy
.always,.never,.custom.
💡 Vì sao đáng chú ý
RxGesture giải quyết pain point delegate-based gesture recognizers: boilerplate delegate code, state management thủ công, khó kết hợp nhiều gesture. Với RxSwift, mọi gesture trở thành Observable — dễ filter, combine, dispose. Phù hợp project đang dùng RxSwift cần xử lý gesture phức tạp như photo preview dismiss bằng tap hoặc swipe.
#RxSwift #Gesture #iOS #macOS #Swift #TiniX
Similar Projects
Discover other similar projects and AI models.
🖼 React library to support easy zoom, pan, pinch on various html dom elements like <img> and <div>
Bark is an iOS App which allows you to push custom notifications to your iPhone
Swipeable UITableViewCell/UICollectionViewCell based on the stock Mail.app, implemented in Swift.