i'm trying to use this framework that provides a navigation bar like Tinder's (Swift 3).
my goal is to use this in a transperant way - meaning - to embed it and have 3 independent view controllers on storyboard, with their VC.swift files and use segues.
Here is a working test project with Tinder style and 3 ViewControllers from Storyboard.
before using it in my project i wanted to test it so i updated this project.
As i saw, nav is the UINavigationController that have the 3 VC's and switching between them. i wanted to see him on the storyboard.
so insted of:
var nav: UINavigationController?
i created a UINavigationController on the UI builder and UINavigationController class called MainNavigationController.
var nav: MainNavigationController?
nav = mainStb.instantiateViewController(withIdentifier: "mainNavigationController") as? MainNavigationController
i also added a simple initial view controller to storyboard, from this VC i segue (using a button) to the MainNavigationController:
@IBAction func buttonSegue(_ sender: Any) {
setNav()
self.performSegue(withIdentifier: "segue", sender: nil)
}
func setNav() {
//// implement my logic (if logged in go to... if not go to...)
instantiateControllers()
setItems()
let items = [UIImageView(image: chat),
UIImageView(image: gear),
UIImageView(image: profile)]
let controllers = [oneVC!,
twoVC!,
threeVC!] as [UIViewController]
controller = SLPagingViewSwift(items: items, controllers: controllers, showPageControl: false)
setupController()
nav = MainNavigationController(rootViewController: controller)
appDelegate.window?.rootViewController = nav
appDelegate.window?.makeKeyAndVisible()
}
it all works so far. BUT:
The only problem i currently have is that i don't have control on the segues. in the 3 view controllers i added
override func prepare(for segue: UIStoryboardSegue, sender: Any?)
but it is never hitting this method. i need it to pass data between view controllers. how can it be done?
Additionally, how would you implement a segue from one view controller to another by tapping an element (like a button)? if i set a regular segue, using a button, from one VC to another - it shows the target VC without the navigation bar
i uploaded my current implementation here.
any help will be appricieated. thanks.