0

enter image description hereI'm using CarbonKit in ViewController. Its working fine. Here, I'm using one tableview for all Segment Array title ID. And i got title ID when i was selected Tab and swipe, and stuck with passing array title ID to server(TableView) when i'll changing index from left ---> right & right ---> left.

My Code: Names Array

 self.carbonTabSwipeNavigation = CarbonTabSwipeNavigation(items: self.names as [AnyObject], delegate: self)

setting ViewController

 func carbonTabSwipeNavigation(_ carbonTabSwipeNavigation: CarbonTabSwipeNavigation, viewControllerAt index: UInt) -> UIViewController {

    studentid = studentidArray.object(at: Int(index)) as! String
    print(studentid)
    return self.storyboard!.instantiateViewController(withIdentifier: "LeaveTableVC") as! LeaveTableVC
}

I has shown names on 'ViewController' with 'tableview'. Now I need to send name of ID to server, when swipe and tap the segment tab. Please help i'm stuck. Thank you

venkat
  • 21
  • 9
  • Do you need to pass the title of its tab to your current view controller ? – Francesco Deliro Oct 28 '17 at 08:31
  • @FrancescoDeliro Yes, I gave array list to tab (this array list coming from server). Its working fine. Here, Each of array having ID (Array). I want pass ID to server, when i move to current and next tableview. I'm using One Tableview for all segment tab. just data will be changing depend on array ID. – venkat Oct 28 '17 at 08:42
  • So LeaveTableVC is where you load your server data and it’s the same controller for all your tabs. I think that in this view controller you have your logic for your server query, is it correct? And studentID is the parameter you want to send to the server? – Francesco Deliro Oct 28 '17 at 09:00
  • @FrancescoDeliro. Once check my update Post. I created separate 'viewcontroller' and add into 'carbonkit viewcontroller'. Yes, studentID is the parameter and send to server. right – venkat Oct 28 '17 at 09:59
  • Ok thank you, I have edited my answer ;) – Francesco Deliro Oct 28 '17 at 10:22

1 Answers1

0

Ok if I understand the thing is that your LeaveTableVC is the root view controller of the Carbon Kit controller, I think that would be better if you use a different TableViewController that could be the same for all your tabs, but anyway studentID is not your new LeaveTableVC instance property but is the current LeaveTableVC property. So for example you need to do:

func carbonTabSwipeNavigation(_ carbonTabSwipeNavigation: CarbonTabSwipeNavigation, viewControllerAt index: UInt) -> UIViewController {
    let nextVC = self.storyboard!.instantiateViewController(withIdentifier: "LeaveTableVC") as! LeaveTableVC
    nextVC.studentid = studentidArray.object(at: Int(index)) as! String
    print(studentid)
    return nextVC
}
Francesco Deliro
  • 3,899
  • 2
  • 19
  • 24
  • Thanks ! It's my fault. I did mistake 'return self' instead of as u like. Thank you Again. – venkat Oct 28 '17 at 10:39
  • Can you please check this one : [link] (https://stackoverflow.com/questions/46949490/how-can-i-make-send-array-of-dictionary-json-format-send-to-server-using-al) – venkat Oct 28 '17 at 10:41
  • Sure, I will check it ;) and you can accept my answer here, thanks! – Francesco Deliro Oct 28 '17 at 10:44