How to get data from popup view controller to custom table view cell?Passing Data between View ControllersHow to detect tableView cell touched or clicked in swiftExpand and Collapse tableview cellsUpdate or reload UITableView after completion of delete action on detail viewTableView not displaying text with JSON data from API callCan't implement required methods of JSQMessagesViewController Swift 3Adding a custom UIViewcontroller to subview programmatically but getting an error message “Cannot convert value of type…”Swift Error - Use of undeclared type 'cell' - Collection ViewSwift vertical UICollectionView inside UITableViewReload data Collection View inside Table view Cell (Swift)

Reasons for having MCU pin-states default to pull-up/down out of reset

PTIJ: Which Dr. Seuss books should one obtain?

Highest stage count that are used one right after the other?

What is the tangent at a sharp point on a curve?

What is it called when someone votes for an option that's not their first choice?

What do the positive and negative (+/-) transmit and receive pins mean on Ethernet cables?

Relations between homogeneous polynomials

Why does a 97 / 92 key piano exist by Bosendorfer?

"Oh no!" in Latin

I keep switching characters, how do I stop?

Did I make a mistake by ccing email to boss to others?

How do I lift the insulation blower into the attic?

Can you describe someone as luxurious? As in someone who likes luxurious things?

Do I have to take mana from my deck or hand when tapping this card?

How can I, as DM, avoid the Conga Line of Death occurring when implementing some form of flanking rule?

Started in 1987 vs. Starting in 1987

A seasonal riddle

Do people actually use the word "kaputt" in conversation?

What should be the ideal length of sentences in a blog post for ease of reading?

What is the purpose of using a decision tree?

What is the period/term used describe Giuseppe Arcimboldo's style of painting?

Trouble reading roman numeral notation with flats

Writing in a Christian voice

Not hide and seek



How to get data from popup view controller to custom table view cell?


Passing Data between View ControllersHow to detect tableView cell touched or clicked in swiftExpand and Collapse tableview cellsUpdate or reload UITableView after completion of delete action on detail viewTableView not displaying text with JSON data from API callCan't implement required methods of JSQMessagesViewController Swift 3Adding a custom UIViewcontroller to subview programmatically but getting an error message “Cannot convert value of type…”Swift Error - Use of undeclared type 'cell' - Collection ViewSwift vertical UICollectionView inside UITableViewReload data Collection View inside Table view Cell (Swift)













0















enter image description here



I have 3 view controllers. First is MainViewController.



In this MainViewController has custom table view cell as FoodCell class with two property as name and price.



I instantiate this objects in MainViewController and when tap to table view cell this objects pass to popup DetailViewController which is not table view it is only View with labels(foodName and foodPrice labels) and AddToBasket button.



And finally I want to pass this class objects from popup DetailViewController to MyCartViewController. MyCartViewController is my final scene for show the foodNames and foodPrices objects.



(e.g. MainViewController is my food menu list. DetailViewController is my selected foods list.MyCartViewController is my market bag. )



MainViewController(Food Menu List)



import UIKit

class MainViewController: UIViewController, UITableViewDataSource, UITableViewDelegate,
UICollectionViewDelegate, UICollectionViewDataSource, UICollectionViewDelegateFlowLayout

@IBOutlet weak var searchBar: UISearchBar!
@IBOutlet weak var mainTableView: UITableView!

var imageNames = [ImageNames]()
var searchFoods: [String]!
var priceFood: [Double]!
var searching = false


override func viewWillAppear(_ animated: Bool)
super.viewWillAppear(animated)
self.tabBarController?.tabBar.isHidden = false


override func viewDidLoad()
super.viewDidLoad()

self.navigationController?.navigationBar.isHidden = true
let foodCell = Food(name: ["Hamburger big mac",
"Patates",
"Whopper",
"Steakhouse"], price: [15.0, 20.0, 25.0, 30.0])

searchBar.delegate = self
searchFoods = foodCell.name
priceFood = foodCell.price

imageNames = [
ImageNames(name: "images"),
ImageNames(name: "unnamed"),
ImageNames(name: "unnamed")
]



func numberOfSections(in tableView: UITableView) -> Int
return 2


func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int

return section == 0 ? 1 : searchFoods.count


func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat
return indexPath.section == 0 ? 130 : 65


func tableView(_ tableView: UITableView, estimatedHeightForRowAt indexPath: IndexPath) -> CGFloat
return indexPath.section == 0 ? 100 : 65


func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell
if indexPath.section == 0
let cell = tableView.dequeueReusableCell(withIdentifier: "MainFoodTableViewCell", for: indexPath) as! MainFoodTableViewCell

cell.mainFoodCollectionView.delegate = self
cell.mainFoodCollectionView.dataSource = self
cell.mainFoodCollectionView.reloadData()
cell.mainFoodCollectionView.tag = indexPath.row
return cell

else

let cell = tableView.dequeueReusableCell(withIdentifier: "CellForFood", for: indexPath) as! MainFoodTitleTableViewCell

cell.titleLabel?.text = searchFoods[indexPath.row]
cell.priceLabel?.text = priceFood[indexPath.row].description

return cell




override func prepare(for segue: UIStoryboardSegue, sender: Any?)
if segue.identifier == "cellForFoodSegue"
if let destinationViewController = segue.destination as? DetailViewController

let indexPath = self.mainTableView.indexPathForSelectedRow!

var foodNameArray: [String]
var foodPriceArray: [Double]

foodNameArray = [searchFoods[indexPath.row]]
foodPriceArray = [priceFood[indexPath.row]]

destinationViewController.detailFoodName = foodNameArray
destinationViewController.detailFoodPrice = foodPriceArray






func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int
return imageNames.count


//MARK:- collection view cell size
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize
let width = UIScreen.main.bounds.width
return CGSize(width: width, height: 130)


//MARK:- //collection view cell data
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "MainFoodCollectionViewCell", for: indexPath) as! MainFoodCollectionViewCell
let img = imageNames[indexPath.row]
cell.mainFoodImage.image = UIImage(named: img.name)
return cell




DetailViewController(Selected Foods List)



import UIKit

class DetailViewController: UIViewController

@IBOutlet weak var foodTitle: UILabel!
@IBOutlet weak var foodSubTitle: UILabel!
@IBOutlet weak var foodPiece: UILabel!
@IBOutlet weak var foodPrice: UILabel!
@IBOutlet weak var drinkPicker: UITextField!
@IBOutlet weak var menuPieceStepper: UIStepper!

var drinkPickerView = UIPickerView()

var selectDrinkType: [String] = []
var detailFoodName : [String] = []
var detailFoodPrice : [Double] = [0.0]



let foods = Food(name: ["Hamburger big mac",
"Patates",
"Whopper",
"Steakhouse"], price: [15.0, 20.0, 25.0, 30.0])


@IBAction func foodPieceStepper(_ sender: Any)


@objc func foodPieceChangeStepper()
let res = menuPieceStepper.value + foods.price.first!
foodPrice.text = "(res)"


//TODO:- Add to basket
@IBAction func addBasket(_ sender: Any)

let destinationVC = MyCartViewController()

destinationVC.fromDetailFoodNames = foods.name
destinationVC.fromDetailFoodPrices = foods.price


override func prepare(for segue: UIStoryboardSegue, sender: Any?)
if(segue.identifier == "addToCartSegue")
if let addToCartVC = segue.destination as? MyCartViewController
addToCartVC.fromDetailFoodNames = [foodTitle.text]
addToCartVC.fromDetailFoodPrices = foods.price




override func viewDidLoad()
super.viewDidLoad()

menuPieceStepper.value = 0.0
menuPieceStepper.minimumValue = 0.0
menuPieceStepper.maximumValue = 30.0
menuPieceStepper.stepValue = foods.price.first!
menuPieceStepper.addTarget(self, action: #selector(foodPieceChangeStepper), for: .valueChanged)

drinkPickerView.delegate = self
drinkPicker.inputView = drinkPickerView
selectDrinkType = ["Ayran", "Kola", "Su", "Fanta", "Şalgam", "Sprite"]

foodTitle.text = detailFoodName.description
foodPrice.text = detailFoodPrice.description


self.navigationController?.navigationItem.title = "Sipariş Detayı"
let tapGesture = UITapGestureRecognizer(target: self, action: #selector(self.dismissKeyboard (_:)))
self.view.addGestureRecognizer(tapGesture)

@objc func dismissKeyboard (_ sender: UITapGestureRecognizer)
drinkPicker.resignFirstResponder()


override func viewWillAppear(_ animated: Bool)
self.navigationController?.navigationBar.isHidden = false



override func viewWillDisappear(_ animated: Bool)
self.navigationController?.navigationBar.isHidden = true



extension DetailViewController: UIPickerViewDelegate, UIPickerViewDataSource
func numberOfComponents(in pickerView: UIPickerView) -> Int
return 1


func pickerView(_ pickerView: UIPickerView, numberOfRowsInComponent component: Int) -> Int
return selectDrinkType.count


func pickerView(_ pickerView: UIPickerView, titleForRow row: Int, forComponent component: Int) -> String?
return selectDrinkType[row]


func pickerView(_ pickerView: UIPickerView, didSelectRow row: Int, inComponent component: Int)
let selectedDrink = selectDrinkType[row]
drinkPicker.text = selectedDrink





MyCartViewController(My Grocery Bag)



import UIKit

class MyCartViewController: UIViewController, UITableViewDataSource, UITableViewDelegate

var fromDetailFoodNames: [String?] = []
var fromDetailFoodPrices: [Double?] = []

@IBOutlet weak var myCartTableView: UITableView!
@IBOutlet weak var totalPriceLabel: UILabel!


let foodNames = [
"Hamburger big mac",
"Cemal",
"Emre",
"Memo"
]

//TODO-: Delete my cart
@IBAction func deleteMyCart(_ sender: Any)


//TODO: - Approve my cart
@IBAction func approveCart(_ sender: Any)



override func viewDidLoad()
super.viewDidLoad()


func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int

return section == 0 ? 1 : foodNames.count


func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell

let cell = tableView.dequeueReusableCell(withIdentifier: "myCartCell", for: indexPath) as! MyCartTableViewCell

if indexPath.section == 1 && indexPath.last! <= fromDetailFoodPrices.indices.last!

let name = fromDetailFoodNames[indexPath.row]?.description ?? ""
let price = fromDetailFoodPrices[indexPath.row]
cell.myCartFoodNameLabel?.text = name
cell.myCartFoodPriceLabel?.text = "(String(describing: price))₺"


return cell











share|improve this question
























  • ok i saw your flow , i have a query please tell me, is there any api on detail ViewController for send data? if not create Dictonary [String:Any] add your all data in dictonary [keys : value ], save your dictonary on sepete ekle button in user default, when you are on cart View controller fetch your dictonary and append in Array [[String:Any]] on viewdidload....

    – Sukhwinder Singh
    Mar 12 at 12:21












  • @sukhwinder-singh No , I am just using dummy datas to be sure about can I pass data with 3 views. If I create Dictionary on Detail VC it will be independent data created on DetailVC? So, it is not about which data is coming from MainVC.

    – Emre Değirmenci
    Mar 12 at 15:25















0















enter image description here



I have 3 view controllers. First is MainViewController.



In this MainViewController has custom table view cell as FoodCell class with two property as name and price.



I instantiate this objects in MainViewController and when tap to table view cell this objects pass to popup DetailViewController which is not table view it is only View with labels(foodName and foodPrice labels) and AddToBasket button.



And finally I want to pass this class objects from popup DetailViewController to MyCartViewController. MyCartViewController is my final scene for show the foodNames and foodPrices objects.



(e.g. MainViewController is my food menu list. DetailViewController is my selected foods list.MyCartViewController is my market bag. )



MainViewController(Food Menu List)



import UIKit

class MainViewController: UIViewController, UITableViewDataSource, UITableViewDelegate,
UICollectionViewDelegate, UICollectionViewDataSource, UICollectionViewDelegateFlowLayout

@IBOutlet weak var searchBar: UISearchBar!
@IBOutlet weak var mainTableView: UITableView!

var imageNames = [ImageNames]()
var searchFoods: [String]!
var priceFood: [Double]!
var searching = false


override func viewWillAppear(_ animated: Bool)
super.viewWillAppear(animated)
self.tabBarController?.tabBar.isHidden = false


override func viewDidLoad()
super.viewDidLoad()

self.navigationController?.navigationBar.isHidden = true
let foodCell = Food(name: ["Hamburger big mac",
"Patates",
"Whopper",
"Steakhouse"], price: [15.0, 20.0, 25.0, 30.0])

searchBar.delegate = self
searchFoods = foodCell.name
priceFood = foodCell.price

imageNames = [
ImageNames(name: "images"),
ImageNames(name: "unnamed"),
ImageNames(name: "unnamed")
]



func numberOfSections(in tableView: UITableView) -> Int
return 2


func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int

return section == 0 ? 1 : searchFoods.count


func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat
return indexPath.section == 0 ? 130 : 65


func tableView(_ tableView: UITableView, estimatedHeightForRowAt indexPath: IndexPath) -> CGFloat
return indexPath.section == 0 ? 100 : 65


func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell
if indexPath.section == 0
let cell = tableView.dequeueReusableCell(withIdentifier: "MainFoodTableViewCell", for: indexPath) as! MainFoodTableViewCell

cell.mainFoodCollectionView.delegate = self
cell.mainFoodCollectionView.dataSource = self
cell.mainFoodCollectionView.reloadData()
cell.mainFoodCollectionView.tag = indexPath.row
return cell

else

let cell = tableView.dequeueReusableCell(withIdentifier: "CellForFood", for: indexPath) as! MainFoodTitleTableViewCell

cell.titleLabel?.text = searchFoods[indexPath.row]
cell.priceLabel?.text = priceFood[indexPath.row].description

return cell




override func prepare(for segue: UIStoryboardSegue, sender: Any?)
if segue.identifier == "cellForFoodSegue"
if let destinationViewController = segue.destination as? DetailViewController

let indexPath = self.mainTableView.indexPathForSelectedRow!

var foodNameArray: [String]
var foodPriceArray: [Double]

foodNameArray = [searchFoods[indexPath.row]]
foodPriceArray = [priceFood[indexPath.row]]

destinationViewController.detailFoodName = foodNameArray
destinationViewController.detailFoodPrice = foodPriceArray






func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int
return imageNames.count


//MARK:- collection view cell size
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize
let width = UIScreen.main.bounds.width
return CGSize(width: width, height: 130)


//MARK:- //collection view cell data
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "MainFoodCollectionViewCell", for: indexPath) as! MainFoodCollectionViewCell
let img = imageNames[indexPath.row]
cell.mainFoodImage.image = UIImage(named: img.name)
return cell




DetailViewController(Selected Foods List)



import UIKit

class DetailViewController: UIViewController

@IBOutlet weak var foodTitle: UILabel!
@IBOutlet weak var foodSubTitle: UILabel!
@IBOutlet weak var foodPiece: UILabel!
@IBOutlet weak var foodPrice: UILabel!
@IBOutlet weak var drinkPicker: UITextField!
@IBOutlet weak var menuPieceStepper: UIStepper!

var drinkPickerView = UIPickerView()

var selectDrinkType: [String] = []
var detailFoodName : [String] = []
var detailFoodPrice : [Double] = [0.0]



let foods = Food(name: ["Hamburger big mac",
"Patates",
"Whopper",
"Steakhouse"], price: [15.0, 20.0, 25.0, 30.0])


@IBAction func foodPieceStepper(_ sender: Any)


@objc func foodPieceChangeStepper()
let res = menuPieceStepper.value + foods.price.first!
foodPrice.text = "(res)"


//TODO:- Add to basket
@IBAction func addBasket(_ sender: Any)

let destinationVC = MyCartViewController()

destinationVC.fromDetailFoodNames = foods.name
destinationVC.fromDetailFoodPrices = foods.price


override func prepare(for segue: UIStoryboardSegue, sender: Any?)
if(segue.identifier == "addToCartSegue")
if let addToCartVC = segue.destination as? MyCartViewController
addToCartVC.fromDetailFoodNames = [foodTitle.text]
addToCartVC.fromDetailFoodPrices = foods.price




override func viewDidLoad()
super.viewDidLoad()

menuPieceStepper.value = 0.0
menuPieceStepper.minimumValue = 0.0
menuPieceStepper.maximumValue = 30.0
menuPieceStepper.stepValue = foods.price.first!
menuPieceStepper.addTarget(self, action: #selector(foodPieceChangeStepper), for: .valueChanged)

drinkPickerView.delegate = self
drinkPicker.inputView = drinkPickerView
selectDrinkType = ["Ayran", "Kola", "Su", "Fanta", "Şalgam", "Sprite"]

foodTitle.text = detailFoodName.description
foodPrice.text = detailFoodPrice.description


self.navigationController?.navigationItem.title = "Sipariş Detayı"
let tapGesture = UITapGestureRecognizer(target: self, action: #selector(self.dismissKeyboard (_:)))
self.view.addGestureRecognizer(tapGesture)

@objc func dismissKeyboard (_ sender: UITapGestureRecognizer)
drinkPicker.resignFirstResponder()


override func viewWillAppear(_ animated: Bool)
self.navigationController?.navigationBar.isHidden = false



override func viewWillDisappear(_ animated: Bool)
self.navigationController?.navigationBar.isHidden = true



extension DetailViewController: UIPickerViewDelegate, UIPickerViewDataSource
func numberOfComponents(in pickerView: UIPickerView) -> Int
return 1


func pickerView(_ pickerView: UIPickerView, numberOfRowsInComponent component: Int) -> Int
return selectDrinkType.count


func pickerView(_ pickerView: UIPickerView, titleForRow row: Int, forComponent component: Int) -> String?
return selectDrinkType[row]


func pickerView(_ pickerView: UIPickerView, didSelectRow row: Int, inComponent component: Int)
let selectedDrink = selectDrinkType[row]
drinkPicker.text = selectedDrink





MyCartViewController(My Grocery Bag)



import UIKit

class MyCartViewController: UIViewController, UITableViewDataSource, UITableViewDelegate

var fromDetailFoodNames: [String?] = []
var fromDetailFoodPrices: [Double?] = []

@IBOutlet weak var myCartTableView: UITableView!
@IBOutlet weak var totalPriceLabel: UILabel!


let foodNames = [
"Hamburger big mac",
"Cemal",
"Emre",
"Memo"
]

//TODO-: Delete my cart
@IBAction func deleteMyCart(_ sender: Any)


//TODO: - Approve my cart
@IBAction func approveCart(_ sender: Any)



override func viewDidLoad()
super.viewDidLoad()


func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int

return section == 0 ? 1 : foodNames.count


func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell

let cell = tableView.dequeueReusableCell(withIdentifier: "myCartCell", for: indexPath) as! MyCartTableViewCell

if indexPath.section == 1 && indexPath.last! <= fromDetailFoodPrices.indices.last!

let name = fromDetailFoodNames[indexPath.row]?.description ?? ""
let price = fromDetailFoodPrices[indexPath.row]
cell.myCartFoodNameLabel?.text = name
cell.myCartFoodPriceLabel?.text = "(String(describing: price))₺"


return cell











share|improve this question
























  • ok i saw your flow , i have a query please tell me, is there any api on detail ViewController for send data? if not create Dictonary [String:Any] add your all data in dictonary [keys : value ], save your dictonary on sepete ekle button in user default, when you are on cart View controller fetch your dictonary and append in Array [[String:Any]] on viewdidload....

    – Sukhwinder Singh
    Mar 12 at 12:21












  • @sukhwinder-singh No , I am just using dummy datas to be sure about can I pass data with 3 views. If I create Dictionary on Detail VC it will be independent data created on DetailVC? So, it is not about which data is coming from MainVC.

    – Emre Değirmenci
    Mar 12 at 15:25













0












0








0








enter image description here



I have 3 view controllers. First is MainViewController.



In this MainViewController has custom table view cell as FoodCell class with two property as name and price.



I instantiate this objects in MainViewController and when tap to table view cell this objects pass to popup DetailViewController which is not table view it is only View with labels(foodName and foodPrice labels) and AddToBasket button.



And finally I want to pass this class objects from popup DetailViewController to MyCartViewController. MyCartViewController is my final scene for show the foodNames and foodPrices objects.



(e.g. MainViewController is my food menu list. DetailViewController is my selected foods list.MyCartViewController is my market bag. )



MainViewController(Food Menu List)



import UIKit

class MainViewController: UIViewController, UITableViewDataSource, UITableViewDelegate,
UICollectionViewDelegate, UICollectionViewDataSource, UICollectionViewDelegateFlowLayout

@IBOutlet weak var searchBar: UISearchBar!
@IBOutlet weak var mainTableView: UITableView!

var imageNames = [ImageNames]()
var searchFoods: [String]!
var priceFood: [Double]!
var searching = false


override func viewWillAppear(_ animated: Bool)
super.viewWillAppear(animated)
self.tabBarController?.tabBar.isHidden = false


override func viewDidLoad()
super.viewDidLoad()

self.navigationController?.navigationBar.isHidden = true
let foodCell = Food(name: ["Hamburger big mac",
"Patates",
"Whopper",
"Steakhouse"], price: [15.0, 20.0, 25.0, 30.0])

searchBar.delegate = self
searchFoods = foodCell.name
priceFood = foodCell.price

imageNames = [
ImageNames(name: "images"),
ImageNames(name: "unnamed"),
ImageNames(name: "unnamed")
]



func numberOfSections(in tableView: UITableView) -> Int
return 2


func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int

return section == 0 ? 1 : searchFoods.count


func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat
return indexPath.section == 0 ? 130 : 65


func tableView(_ tableView: UITableView, estimatedHeightForRowAt indexPath: IndexPath) -> CGFloat
return indexPath.section == 0 ? 100 : 65


func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell
if indexPath.section == 0
let cell = tableView.dequeueReusableCell(withIdentifier: "MainFoodTableViewCell", for: indexPath) as! MainFoodTableViewCell

cell.mainFoodCollectionView.delegate = self
cell.mainFoodCollectionView.dataSource = self
cell.mainFoodCollectionView.reloadData()
cell.mainFoodCollectionView.tag = indexPath.row
return cell

else

let cell = tableView.dequeueReusableCell(withIdentifier: "CellForFood", for: indexPath) as! MainFoodTitleTableViewCell

cell.titleLabel?.text = searchFoods[indexPath.row]
cell.priceLabel?.text = priceFood[indexPath.row].description

return cell




override func prepare(for segue: UIStoryboardSegue, sender: Any?)
if segue.identifier == "cellForFoodSegue"
if let destinationViewController = segue.destination as? DetailViewController

let indexPath = self.mainTableView.indexPathForSelectedRow!

var foodNameArray: [String]
var foodPriceArray: [Double]

foodNameArray = [searchFoods[indexPath.row]]
foodPriceArray = [priceFood[indexPath.row]]

destinationViewController.detailFoodName = foodNameArray
destinationViewController.detailFoodPrice = foodPriceArray






func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int
return imageNames.count


//MARK:- collection view cell size
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize
let width = UIScreen.main.bounds.width
return CGSize(width: width, height: 130)


//MARK:- //collection view cell data
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "MainFoodCollectionViewCell", for: indexPath) as! MainFoodCollectionViewCell
let img = imageNames[indexPath.row]
cell.mainFoodImage.image = UIImage(named: img.name)
return cell




DetailViewController(Selected Foods List)



import UIKit

class DetailViewController: UIViewController

@IBOutlet weak var foodTitle: UILabel!
@IBOutlet weak var foodSubTitle: UILabel!
@IBOutlet weak var foodPiece: UILabel!
@IBOutlet weak var foodPrice: UILabel!
@IBOutlet weak var drinkPicker: UITextField!
@IBOutlet weak var menuPieceStepper: UIStepper!

var drinkPickerView = UIPickerView()

var selectDrinkType: [String] = []
var detailFoodName : [String] = []
var detailFoodPrice : [Double] = [0.0]



let foods = Food(name: ["Hamburger big mac",
"Patates",
"Whopper",
"Steakhouse"], price: [15.0, 20.0, 25.0, 30.0])


@IBAction func foodPieceStepper(_ sender: Any)


@objc func foodPieceChangeStepper()
let res = menuPieceStepper.value + foods.price.first!
foodPrice.text = "(res)"


//TODO:- Add to basket
@IBAction func addBasket(_ sender: Any)

let destinationVC = MyCartViewController()

destinationVC.fromDetailFoodNames = foods.name
destinationVC.fromDetailFoodPrices = foods.price


override func prepare(for segue: UIStoryboardSegue, sender: Any?)
if(segue.identifier == "addToCartSegue")
if let addToCartVC = segue.destination as? MyCartViewController
addToCartVC.fromDetailFoodNames = [foodTitle.text]
addToCartVC.fromDetailFoodPrices = foods.price




override func viewDidLoad()
super.viewDidLoad()

menuPieceStepper.value = 0.0
menuPieceStepper.minimumValue = 0.0
menuPieceStepper.maximumValue = 30.0
menuPieceStepper.stepValue = foods.price.first!
menuPieceStepper.addTarget(self, action: #selector(foodPieceChangeStepper), for: .valueChanged)

drinkPickerView.delegate = self
drinkPicker.inputView = drinkPickerView
selectDrinkType = ["Ayran", "Kola", "Su", "Fanta", "Şalgam", "Sprite"]

foodTitle.text = detailFoodName.description
foodPrice.text = detailFoodPrice.description


self.navigationController?.navigationItem.title = "Sipariş Detayı"
let tapGesture = UITapGestureRecognizer(target: self, action: #selector(self.dismissKeyboard (_:)))
self.view.addGestureRecognizer(tapGesture)

@objc func dismissKeyboard (_ sender: UITapGestureRecognizer)
drinkPicker.resignFirstResponder()


override func viewWillAppear(_ animated: Bool)
self.navigationController?.navigationBar.isHidden = false



override func viewWillDisappear(_ animated: Bool)
self.navigationController?.navigationBar.isHidden = true



extension DetailViewController: UIPickerViewDelegate, UIPickerViewDataSource
func numberOfComponents(in pickerView: UIPickerView) -> Int
return 1


func pickerView(_ pickerView: UIPickerView, numberOfRowsInComponent component: Int) -> Int
return selectDrinkType.count


func pickerView(_ pickerView: UIPickerView, titleForRow row: Int, forComponent component: Int) -> String?
return selectDrinkType[row]


func pickerView(_ pickerView: UIPickerView, didSelectRow row: Int, inComponent component: Int)
let selectedDrink = selectDrinkType[row]
drinkPicker.text = selectedDrink





MyCartViewController(My Grocery Bag)



import UIKit

class MyCartViewController: UIViewController, UITableViewDataSource, UITableViewDelegate

var fromDetailFoodNames: [String?] = []
var fromDetailFoodPrices: [Double?] = []

@IBOutlet weak var myCartTableView: UITableView!
@IBOutlet weak var totalPriceLabel: UILabel!


let foodNames = [
"Hamburger big mac",
"Cemal",
"Emre",
"Memo"
]

//TODO-: Delete my cart
@IBAction func deleteMyCart(_ sender: Any)


//TODO: - Approve my cart
@IBAction func approveCart(_ sender: Any)



override func viewDidLoad()
super.viewDidLoad()


func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int

return section == 0 ? 1 : foodNames.count


func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell

let cell = tableView.dequeueReusableCell(withIdentifier: "myCartCell", for: indexPath) as! MyCartTableViewCell

if indexPath.section == 1 && indexPath.last! <= fromDetailFoodPrices.indices.last!

let name = fromDetailFoodNames[indexPath.row]?.description ?? ""
let price = fromDetailFoodPrices[indexPath.row]
cell.myCartFoodNameLabel?.text = name
cell.myCartFoodPriceLabel?.text = "(String(describing: price))₺"


return cell











share|improve this question
















enter image description here



I have 3 view controllers. First is MainViewController.



In this MainViewController has custom table view cell as FoodCell class with two property as name and price.



I instantiate this objects in MainViewController and when tap to table view cell this objects pass to popup DetailViewController which is not table view it is only View with labels(foodName and foodPrice labels) and AddToBasket button.



And finally I want to pass this class objects from popup DetailViewController to MyCartViewController. MyCartViewController is my final scene for show the foodNames and foodPrices objects.



(e.g. MainViewController is my food menu list. DetailViewController is my selected foods list.MyCartViewController is my market bag. )



MainViewController(Food Menu List)



import UIKit

class MainViewController: UIViewController, UITableViewDataSource, UITableViewDelegate,
UICollectionViewDelegate, UICollectionViewDataSource, UICollectionViewDelegateFlowLayout

@IBOutlet weak var searchBar: UISearchBar!
@IBOutlet weak var mainTableView: UITableView!

var imageNames = [ImageNames]()
var searchFoods: [String]!
var priceFood: [Double]!
var searching = false


override func viewWillAppear(_ animated: Bool)
super.viewWillAppear(animated)
self.tabBarController?.tabBar.isHidden = false


override func viewDidLoad()
super.viewDidLoad()

self.navigationController?.navigationBar.isHidden = true
let foodCell = Food(name: ["Hamburger big mac",
"Patates",
"Whopper",
"Steakhouse"], price: [15.0, 20.0, 25.0, 30.0])

searchBar.delegate = self
searchFoods = foodCell.name
priceFood = foodCell.price

imageNames = [
ImageNames(name: "images"),
ImageNames(name: "unnamed"),
ImageNames(name: "unnamed")
]



func numberOfSections(in tableView: UITableView) -> Int
return 2


func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int

return section == 0 ? 1 : searchFoods.count


func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat
return indexPath.section == 0 ? 130 : 65


func tableView(_ tableView: UITableView, estimatedHeightForRowAt indexPath: IndexPath) -> CGFloat
return indexPath.section == 0 ? 100 : 65


func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell
if indexPath.section == 0
let cell = tableView.dequeueReusableCell(withIdentifier: "MainFoodTableViewCell", for: indexPath) as! MainFoodTableViewCell

cell.mainFoodCollectionView.delegate = self
cell.mainFoodCollectionView.dataSource = self
cell.mainFoodCollectionView.reloadData()
cell.mainFoodCollectionView.tag = indexPath.row
return cell

else

let cell = tableView.dequeueReusableCell(withIdentifier: "CellForFood", for: indexPath) as! MainFoodTitleTableViewCell

cell.titleLabel?.text = searchFoods[indexPath.row]
cell.priceLabel?.text = priceFood[indexPath.row].description

return cell




override func prepare(for segue: UIStoryboardSegue, sender: Any?)
if segue.identifier == "cellForFoodSegue"
if let destinationViewController = segue.destination as? DetailViewController

let indexPath = self.mainTableView.indexPathForSelectedRow!

var foodNameArray: [String]
var foodPriceArray: [Double]

foodNameArray = [searchFoods[indexPath.row]]
foodPriceArray = [priceFood[indexPath.row]]

destinationViewController.detailFoodName = foodNameArray
destinationViewController.detailFoodPrice = foodPriceArray






func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int
return imageNames.count


//MARK:- collection view cell size
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize
let width = UIScreen.main.bounds.width
return CGSize(width: width, height: 130)


//MARK:- //collection view cell data
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "MainFoodCollectionViewCell", for: indexPath) as! MainFoodCollectionViewCell
let img = imageNames[indexPath.row]
cell.mainFoodImage.image = UIImage(named: img.name)
return cell




DetailViewController(Selected Foods List)



import UIKit

class DetailViewController: UIViewController

@IBOutlet weak var foodTitle: UILabel!
@IBOutlet weak var foodSubTitle: UILabel!
@IBOutlet weak var foodPiece: UILabel!
@IBOutlet weak var foodPrice: UILabel!
@IBOutlet weak var drinkPicker: UITextField!
@IBOutlet weak var menuPieceStepper: UIStepper!

var drinkPickerView = UIPickerView()

var selectDrinkType: [String] = []
var detailFoodName : [String] = []
var detailFoodPrice : [Double] = [0.0]



let foods = Food(name: ["Hamburger big mac",
"Patates",
"Whopper",
"Steakhouse"], price: [15.0, 20.0, 25.0, 30.0])


@IBAction func foodPieceStepper(_ sender: Any)


@objc func foodPieceChangeStepper()
let res = menuPieceStepper.value + foods.price.first!
foodPrice.text = "(res)"


//TODO:- Add to basket
@IBAction func addBasket(_ sender: Any)

let destinationVC = MyCartViewController()

destinationVC.fromDetailFoodNames = foods.name
destinationVC.fromDetailFoodPrices = foods.price


override func prepare(for segue: UIStoryboardSegue, sender: Any?)
if(segue.identifier == "addToCartSegue")
if let addToCartVC = segue.destination as? MyCartViewController
addToCartVC.fromDetailFoodNames = [foodTitle.text]
addToCartVC.fromDetailFoodPrices = foods.price




override func viewDidLoad()
super.viewDidLoad()

menuPieceStepper.value = 0.0
menuPieceStepper.minimumValue = 0.0
menuPieceStepper.maximumValue = 30.0
menuPieceStepper.stepValue = foods.price.first!
menuPieceStepper.addTarget(self, action: #selector(foodPieceChangeStepper), for: .valueChanged)

drinkPickerView.delegate = self
drinkPicker.inputView = drinkPickerView
selectDrinkType = ["Ayran", "Kola", "Su", "Fanta", "Şalgam", "Sprite"]

foodTitle.text = detailFoodName.description
foodPrice.text = detailFoodPrice.description


self.navigationController?.navigationItem.title = "Sipariş Detayı"
let tapGesture = UITapGestureRecognizer(target: self, action: #selector(self.dismissKeyboard (_:)))
self.view.addGestureRecognizer(tapGesture)

@objc func dismissKeyboard (_ sender: UITapGestureRecognizer)
drinkPicker.resignFirstResponder()


override func viewWillAppear(_ animated: Bool)
self.navigationController?.navigationBar.isHidden = false



override func viewWillDisappear(_ animated: Bool)
self.navigationController?.navigationBar.isHidden = true



extension DetailViewController: UIPickerViewDelegate, UIPickerViewDataSource
func numberOfComponents(in pickerView: UIPickerView) -> Int
return 1


func pickerView(_ pickerView: UIPickerView, numberOfRowsInComponent component: Int) -> Int
return selectDrinkType.count


func pickerView(_ pickerView: UIPickerView, titleForRow row: Int, forComponent component: Int) -> String?
return selectDrinkType[row]


func pickerView(_ pickerView: UIPickerView, didSelectRow row: Int, inComponent component: Int)
let selectedDrink = selectDrinkType[row]
drinkPicker.text = selectedDrink





MyCartViewController(My Grocery Bag)



import UIKit

class MyCartViewController: UIViewController, UITableViewDataSource, UITableViewDelegate

var fromDetailFoodNames: [String?] = []
var fromDetailFoodPrices: [Double?] = []

@IBOutlet weak var myCartTableView: UITableView!
@IBOutlet weak var totalPriceLabel: UILabel!


let foodNames = [
"Hamburger big mac",
"Cemal",
"Emre",
"Memo"
]

//TODO-: Delete my cart
@IBAction func deleteMyCart(_ sender: Any)


//TODO: - Approve my cart
@IBAction func approveCart(_ sender: Any)



override func viewDidLoad()
super.viewDidLoad()


func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int

return section == 0 ? 1 : foodNames.count


func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell

let cell = tableView.dequeueReusableCell(withIdentifier: "myCartCell", for: indexPath) as! MyCartTableViewCell

if indexPath.section == 1 && indexPath.last! <= fromDetailFoodPrices.indices.last!

let name = fromDetailFoodNames[indexPath.row]?.description ?? ""
let price = fromDetailFoodPrices[indexPath.row]
cell.myCartFoodNameLabel?.text = name
cell.myCartFoodPriceLabel?.text = "(String(describing: price))₺"


return cell








ios swift uitableview tableview swift4.2






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 12 at 11:20







Emre Değirmenci

















asked Mar 7 at 20:24









Emre DeğirmenciEmre Değirmenci

7912




7912












  • ok i saw your flow , i have a query please tell me, is there any api on detail ViewController for send data? if not create Dictonary [String:Any] add your all data in dictonary [keys : value ], save your dictonary on sepete ekle button in user default, when you are on cart View controller fetch your dictonary and append in Array [[String:Any]] on viewdidload....

    – Sukhwinder Singh
    Mar 12 at 12:21












  • @sukhwinder-singh No , I am just using dummy datas to be sure about can I pass data with 3 views. If I create Dictionary on Detail VC it will be independent data created on DetailVC? So, it is not about which data is coming from MainVC.

    – Emre Değirmenci
    Mar 12 at 15:25

















  • ok i saw your flow , i have a query please tell me, is there any api on detail ViewController for send data? if not create Dictonary [String:Any] add your all data in dictonary [keys : value ], save your dictonary on sepete ekle button in user default, when you are on cart View controller fetch your dictonary and append in Array [[String:Any]] on viewdidload....

    – Sukhwinder Singh
    Mar 12 at 12:21












  • @sukhwinder-singh No , I am just using dummy datas to be sure about can I pass data with 3 views. If I create Dictionary on Detail VC it will be independent data created on DetailVC? So, it is not about which data is coming from MainVC.

    – Emre Değirmenci
    Mar 12 at 15:25
















ok i saw your flow , i have a query please tell me, is there any api on detail ViewController for send data? if not create Dictonary [String:Any] add your all data in dictonary [keys : value ], save your dictonary on sepete ekle button in user default, when you are on cart View controller fetch your dictonary and append in Array [[String:Any]] on viewdidload....

– Sukhwinder Singh
Mar 12 at 12:21






ok i saw your flow , i have a query please tell me, is there any api on detail ViewController for send data? if not create Dictonary [String:Any] add your all data in dictonary [keys : value ], save your dictonary on sepete ekle button in user default, when you are on cart View controller fetch your dictonary and append in Array [[String:Any]] on viewdidload....

– Sukhwinder Singh
Mar 12 at 12:21














@sukhwinder-singh No , I am just using dummy datas to be sure about can I pass data with 3 views. If I create Dictionary on Detail VC it will be independent data created on DetailVC? So, it is not about which data is coming from MainVC.

– Emre Değirmenci
Mar 12 at 15:25





@sukhwinder-singh No , I am just using dummy datas to be sure about can I pass data with 3 views. If I create Dictionary on Detail VC it will be independent data created on DetailVC? So, it is not about which data is coming from MainVC.

– Emre Değirmenci
Mar 12 at 15:25












1 Answer
1






active

oldest

votes


















1














// Create Custom delegate for him

// eg:- On PopUp View Controller
// Create protocol
protocol PopUpVCDelegate: class

func refresh(text: String)

// declare delegate var
weak var delegate:PopUpVCDelegate?

// puting value on it
self.delegate?.refresh(text: self.mDateTxtFld.text!)

// On Main ViewController (Recieving Data Class)
extension MainViewController: PopUpVCDelegate
func refresh(text: String)
self.dateLbl.text = text



// and don't forget to call or connect delegate when you present or push popup Vc
//like

let resultController = self.storyboard?.instantiateViewController(withIdentifier: "PopUpVCID") as? PopUpVC

resultController?.delegate = self
self.present(resultController!, animated: true, completion: nil)

// Hope Its work for you!





share|improve this answer























  • I tried 2 times with protocols and delegates but I did not get any result. Could you please use your example with my exact class? I am working with MainViewController which is my first datas in there. Second is DetailViewController from MainViewController. Third and most important view is MyCartViewController.

    – Emre Değirmenci
    Mar 12 at 8:26












  • But you Have 3 ViewController. i don't know your viewController flow, please describe me if its possible?

    – Sukhwinder Singh
    Mar 12 at 10:41











  • I added image to my question

    – Emre Değirmenci
    Mar 12 at 11:21










Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55052243%2fhow-to-get-data-from-popup-view-controller-to-custom-table-view-cell%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









1














// Create Custom delegate for him

// eg:- On PopUp View Controller
// Create protocol
protocol PopUpVCDelegate: class

func refresh(text: String)

// declare delegate var
weak var delegate:PopUpVCDelegate?

// puting value on it
self.delegate?.refresh(text: self.mDateTxtFld.text!)

// On Main ViewController (Recieving Data Class)
extension MainViewController: PopUpVCDelegate
func refresh(text: String)
self.dateLbl.text = text



// and don't forget to call or connect delegate when you present or push popup Vc
//like

let resultController = self.storyboard?.instantiateViewController(withIdentifier: "PopUpVCID") as? PopUpVC

resultController?.delegate = self
self.present(resultController!, animated: true, completion: nil)

// Hope Its work for you!





share|improve this answer























  • I tried 2 times with protocols and delegates but I did not get any result. Could you please use your example with my exact class? I am working with MainViewController which is my first datas in there. Second is DetailViewController from MainViewController. Third and most important view is MyCartViewController.

    – Emre Değirmenci
    Mar 12 at 8:26












  • But you Have 3 ViewController. i don't know your viewController flow, please describe me if its possible?

    – Sukhwinder Singh
    Mar 12 at 10:41











  • I added image to my question

    – Emre Değirmenci
    Mar 12 at 11:21















1














// Create Custom delegate for him

// eg:- On PopUp View Controller
// Create protocol
protocol PopUpVCDelegate: class

func refresh(text: String)

// declare delegate var
weak var delegate:PopUpVCDelegate?

// puting value on it
self.delegate?.refresh(text: self.mDateTxtFld.text!)

// On Main ViewController (Recieving Data Class)
extension MainViewController: PopUpVCDelegate
func refresh(text: String)
self.dateLbl.text = text



// and don't forget to call or connect delegate when you present or push popup Vc
//like

let resultController = self.storyboard?.instantiateViewController(withIdentifier: "PopUpVCID") as? PopUpVC

resultController?.delegate = self
self.present(resultController!, animated: true, completion: nil)

// Hope Its work for you!





share|improve this answer























  • I tried 2 times with protocols and delegates but I did not get any result. Could you please use your example with my exact class? I am working with MainViewController which is my first datas in there. Second is DetailViewController from MainViewController. Third and most important view is MyCartViewController.

    – Emre Değirmenci
    Mar 12 at 8:26












  • But you Have 3 ViewController. i don't know your viewController flow, please describe me if its possible?

    – Sukhwinder Singh
    Mar 12 at 10:41











  • I added image to my question

    – Emre Değirmenci
    Mar 12 at 11:21













1












1








1







// Create Custom delegate for him

// eg:- On PopUp View Controller
// Create protocol
protocol PopUpVCDelegate: class

func refresh(text: String)

// declare delegate var
weak var delegate:PopUpVCDelegate?

// puting value on it
self.delegate?.refresh(text: self.mDateTxtFld.text!)

// On Main ViewController (Recieving Data Class)
extension MainViewController: PopUpVCDelegate
func refresh(text: String)
self.dateLbl.text = text



// and don't forget to call or connect delegate when you present or push popup Vc
//like

let resultController = self.storyboard?.instantiateViewController(withIdentifier: "PopUpVCID") as? PopUpVC

resultController?.delegate = self
self.present(resultController!, animated: true, completion: nil)

// Hope Its work for you!





share|improve this answer













// Create Custom delegate for him

// eg:- On PopUp View Controller
// Create protocol
protocol PopUpVCDelegate: class

func refresh(text: String)

// declare delegate var
weak var delegate:PopUpVCDelegate?

// puting value on it
self.delegate?.refresh(text: self.mDateTxtFld.text!)

// On Main ViewController (Recieving Data Class)
extension MainViewController: PopUpVCDelegate
func refresh(text: String)
self.dateLbl.text = text



// and don't forget to call or connect delegate when you present or push popup Vc
//like

let resultController = self.storyboard?.instantiateViewController(withIdentifier: "PopUpVCID") as? PopUpVC

resultController?.delegate = self
self.present(resultController!, animated: true, completion: nil)

// Hope Its work for you!






share|improve this answer












share|improve this answer



share|improve this answer










answered Mar 12 at 8:13









Sukhwinder SinghSukhwinder Singh

596




596












  • I tried 2 times with protocols and delegates but I did not get any result. Could you please use your example with my exact class? I am working with MainViewController which is my first datas in there. Second is DetailViewController from MainViewController. Third and most important view is MyCartViewController.

    – Emre Değirmenci
    Mar 12 at 8:26












  • But you Have 3 ViewController. i don't know your viewController flow, please describe me if its possible?

    – Sukhwinder Singh
    Mar 12 at 10:41











  • I added image to my question

    – Emre Değirmenci
    Mar 12 at 11:21

















  • I tried 2 times with protocols and delegates but I did not get any result. Could you please use your example with my exact class? I am working with MainViewController which is my first datas in there. Second is DetailViewController from MainViewController. Third and most important view is MyCartViewController.

    – Emre Değirmenci
    Mar 12 at 8:26












  • But you Have 3 ViewController. i don't know your viewController flow, please describe me if its possible?

    – Sukhwinder Singh
    Mar 12 at 10:41











  • I added image to my question

    – Emre Değirmenci
    Mar 12 at 11:21
















I tried 2 times with protocols and delegates but I did not get any result. Could you please use your example with my exact class? I am working with MainViewController which is my first datas in there. Second is DetailViewController from MainViewController. Third and most important view is MyCartViewController.

– Emre Değirmenci
Mar 12 at 8:26






I tried 2 times with protocols and delegates but I did not get any result. Could you please use your example with my exact class? I am working with MainViewController which is my first datas in there. Second is DetailViewController from MainViewController. Third and most important view is MyCartViewController.

– Emre Değirmenci
Mar 12 at 8:26














But you Have 3 ViewController. i don't know your viewController flow, please describe me if its possible?

– Sukhwinder Singh
Mar 12 at 10:41





But you Have 3 ViewController. i don't know your viewController flow, please describe me if its possible?

– Sukhwinder Singh
Mar 12 at 10:41













I added image to my question

– Emre Değirmenci
Mar 12 at 11:21





I added image to my question

– Emre Değirmenci
Mar 12 at 11:21



















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55052243%2fhow-to-get-data-from-popup-view-controller-to-custom-table-view-cell%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Identity Server 4 is not redirecting to Angular app after login2019 Community Moderator ElectionIdentity Server 4 and dockerIdentityserver implicit flow unauthorized_clientIdentityServer Hybrid Flow - Access Token is null after user successful loginIdentity Server to MVC client : Page Redirect After loginLogin with Steam OpenId(oidc-client-js)Identity Server 4+.NET Core 2.0 + IdentityIdentityServer4 post-login redirect not working in Edge browserCall to IdentityServer4 generates System.NullReferenceException: Object reference not set to an instance of an objectIdentityServer4 without HTTPS not workingHow to get Authorization code from identity server without login form

2005 Ahvaz unrest Contents Background Causes Casualties Aftermath See also References Navigation menue"At Least 10 Are Killed by Bombs in Iran""Iran"Archived"Arab-Iranians in Iran to make April 15 'Day of Fury'"State of Mind, State of Order: Reactions to Ethnic Unrest in the Islamic Republic of Iran.10.1111/j.1754-9469.2008.00028.x"Iran hangs Arab separatists"Iran Overview from ArchivedConstitution of the Islamic Republic of Iran"Tehran puzzled by forged 'riots' letter""Iran and its minorities: Down in the second class""Iran: Handling Of Ahvaz Unrest Could End With Televised Confessions""Bombings Rock Iran Ahead of Election""Five die in Iran ethnic clashes""Iran: Need for restraint as anniversary of unrest in Khuzestan approaches"Archived"Iranian Sunni protesters killed in clashes with security forces"Archived

Can't initialize raids on a new ASUS Prime B360M-A motherboard2019 Community Moderator ElectionSimilar to RAID config yet more like mirroring solution?Can't get motherboard serial numberWhy does the BIOS entry point start with a WBINVD instruction?UEFI performance Asus Maximus V Extreme