vooo
vooo

Reputation: 11

how to send data from UIViewController to UITabBarControllers first tab in swift ios

First login screen. after login I am receiving JSON data i parsed that data.know i need to send that data to UITabBarControllers first viewcontroller in that viewcontroller I placed labels. I need to fill that labels with this data

override func prepareForSegue(segue: UIStoryboardSegue,sender:AnyObject!)
    {
        if (segue.identifier == "first")
        {

    var svc = segue.destinationViewController as Vc1;
             svc.toPass  = name
            svc.toPass1 = pid
            svc.toPass2 = sex
            svc.toPass3 = dob
            svc.toPass4 = lastvisit
            svc.toPass5 = height
            svc.toPass6 = pulse
            svc.toPass7 = respiration
            svc.toPass8 = temp
            svc.toPass9 = sysbp
            svc.toPass10 = dysbp
            svc.toPass11 = weight
            svc.toPass12 = medicine
            svc.toPass13 = date
            svc.toPass14 = dosage
            svc.toPass15 = drugclass
            svc.toPass16 = duration
            svc.toPass17 = route
            svc.toPass18 = frequency
            svc.toPass19 = drnote
            svc.toPass20 = con_dr

Upvotes: 1

Views: 1361

Answers (2)

Jassi
Jassi

Reputation: 557

Please check the code at this repository. Let me know if any help needed.

https://github.com/jassionly4u/UITabBarController-Swift

Upvotes: 1

pbasdf
pbasdf

Reputation: 21536

If you are segueing to a tabBarController, the destination VC will be a UITabBarController. You can access the first view controller using the tab bar controller's viewControllers property:

let tabBarController = segue.destinationViewController as UITabBarController
let svc = tabBarController.viewControllers![0] as Vc1

Upvotes: 3

Related Questions