I have a segue from my MainViewController to my ThemesTableViewController. After performing the segue, I choose a theme on my ThemesTableViewController. When I dismiss my ThemesTableViewController, I want to see the theme selected already applied to my MainViewController. How can I achieve that?
// Here's my Theme
struct Theme {
var name: String!
var backgroundColor: UIColor!
...
}
themes = [red, blue, green]
// I have no idea how I can pass chosenTheme to my MainViewController
override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
chosenTheme = themes[indexPath.row]
dismiss(animated: true, completion: nil)
}