Skip to content

Draggable, resizable and rotatable UIView implemented using protocols in Swift

Notifications You must be signed in to change notification settings

Rep2/TransformableView

Repository files navigation

TransformableView

Draggable, resizable and rotatable UIView implemented using protocols in Swift. Uses RxCocoa, RxGesture and RxSwift to avoid protocol extension restrictions.

Usage

TransformableView is a composition of DraggableView, ResizableView and RotatableView. Implement desired protocol as needed.

class View: UIView, TransformableView {}

class NonRotatableView: UIView, DraggableView, ResizableView {}

Protocols require var disposeBag: DisposeBag { get } and include optional func didUpdate(frame: CGRect) and func didUpdate(rotation: CGFloat) methods.

Finnaly, add gesture handling

view.addGesturesHandling()

Example

Demo is included in the project.

Demo

About

Draggable, resizable and rotatable UIView implemented using protocols in Swift

Resources

Stars

Watchers

Forks

Packages

No packages published