SlideController is simple and flexible UI component completely written in Swift. It is nice alternative for UIPageViewController built using power of generic types.
- iOS 9.0+
- Xcode 9.0+
- Swift 4.0+
CocoaPods is a dependency manager for Cocoa projects. You can install it with the following command:
$ gem install cocoapods
To integrate SlideController into your Xcode project using CocoaPods, specify it in your Podfile:
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '10.0'
use_frameworks!
target '<Your Target Name>' do
pod 'SlideController'
endThen, run the following command:
$ pod install
import SlideController- Create content
let content = [
SlideLifeCycleObjectBuilder<PageLifeCycleObject>(),
SlideLifeCycleObjectBuilder<PageLifeCycleObject>(),
SlideLifeCycleObjectBuilder<PageLifeCycleObject>()
]PageLifeCycleObjectis any object conforms toInitializable, Viewable, SlidePageLifeCycleprotocols
- Initialize SlideController
slideController = SlideController<CustomTitleView, CustomTitleItem>(
pagesContent: content,
startPageIndex: 0,
slideDirection: .horizontal
)CustomTitleViewis subclass ofTitleScrollView<CustomTitleItem>CustomTitleItemis subclass ofUIViewand conforms toInitializable, ItemViewable, Selectableprotocols
-
Add
slideController.viewto view hierarchy -
Call
slideController.viewDidAppear()andslideController.viewDidDisappear()in appropriate UIViewController methods:
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
slideController.viewDidAppear()
}override func viewDidDisappear(_ animated: Bool) {
super.viewDidDisappear(animated)
slideController.viewDidDisappear()
}

