I am creating an app that allows the user to see a random quote everyday. In this app, the user is asked 3 questions before being able to actually use the app. The last question is a simple "What is your favorite category/topic". With this prompt, the user will tap a cell and be brought to a Tab Bar Controller with the first "Child" view controller being the quote itself.
Problem: I want the user to be able to tap a UITableViewCell and the one they tap effects which TabBarController they are brought to.
That is the photo with the errors I am running into so far. Here is the code.
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
if(segue.identifier == "bookSegue")
{
let bookQuoteTabBar = segue.destinationViewController as! UITabBarController
let bookQuoteScreen = bookQuoteTabBar.viewControllers?[0] as? bookQuoteScreen
}
else if(segue.identifier == "businessSegue") {
let businessQuoteTabBar: UITabBarController = segue.destinationViewController as! UITabBarController
let businessQuoteScreen = businessQuoteTabBar.viewControllers?[0] as? businessQuoteScreen
}
}
Eventually, there will be more topics, meaning more segues. But for now, I'm starting with two
The segues for each TabBarController are: "bookSegue" "businessSegue"
The Tab Bars are: "bookQuoteTabBar" and "businessQuoteTabBar"
The First "Child" View controllers are: "bookQuoteScreen" "businessQuoteScreen"
Should I have written something else? Did I correctly name the Segues, identities, and classes of each object? If you need more information or references, comment what I should add and I will add it within minutes. Thank you in advance!
---------Recent edits---------
BooksQuoteScreen:
import Foundation
import UIKit
class BooksQuoteScreen: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
BusinessQuoteScreen:
import Foundation
import UIKit
import Social
class BusinessQuoteScreen: UIViewController {
//============================//
//********** Outlets *********//
//============================//
let utility = Utility()
@IBOutlet weak var quoteDisplay: UILabel!
@IBOutlet weak var authorDisplay: UILabel!
@IBOutlet weak var quoteBackground: UIImageView!
...
}