import UIKit
import OverlappingViewsSeparator
class ViewController: UIViewController {
@IBOutlet private var overlappingViews: [UIView]!
private let separator = OverlappingViewsSeparator(minSpacing: 8)
override func viewDidLoad() {
super.viewDidLoad()
separator.register(views: overlappingViews)
}
@IBAction private func apply() {
separator.separate()
}
}
SwiftPM (Recommended)
- On Xcode, click
File
>Swift Packages
>Add Package Dependency...
- Input
https://github.com/malt03/OverlappingViewsSeparator.git
- Insert
pod 'OverlappingViewsSeparator'
to your Podfile. - Run
pod install
.
separator.separate { (reflect) in
UIView.animate(withDuration: 1) {
reflect()
}
}
separator.register(stuckView: stuckView)
separator.reset()
let separator = OverlappingViewsSeparator(queue: .main) // default: .global()