The main file is ./UISwipeView/UISwipeView.swift
Initialize a UISwipeView in viewDidLoad:
override func viewDidLoad() {
super.viewDidLoad()
let contentViews = [view1, view2, ...]
let swipeView = UISwipeView(subviews: contentViews)
self.view.addSubview(swipeView)
constrain(swipeView) { swipe in
// constrain swipeView (this example uses Cartography)
}
swipeView.swipeDidEnd = { chartIndex in
// do something with currentIndex if you'd like
}
}
To initialize a UISwipeView, prepare an outlet to a UISwipeView.
@IBOutlet weak var swipeView: UISwipeView!
Then, in viewDidAppear:
override func viewDidAppear(animated: Bool) {
// Check if swipeView has already been initialized, if bounds were set with storyboard
if swipeView.subViewContents.count == 0 {
swipeView.initFromNibWithSubviews([view1, view2, ...])
swipeView.goTo(someIndex)
// Setup up callback for after a swipe is completed
swipeView.swipeDidEnd = { currentIndex in
// do something with currentIndex if you'd like
}
}
super.viewDidAppear(animated)
}