I am having ViewControllerA and a subView in the same ViewControllerA. I want to know how to pass outlet label value of the ViewContorllerA to its subView.
            Asked
            
        
        
            Active
            
        
            Viewed 65 times
        
    0
            
            
        - 
                    If I got it right, you could do it by creating a [*delegate*](https://stackoverflow.com/questions/40501780/examples-of-delegates-in-swift-3/40503024#40503024) to your subview and pass the desired value by its methods. The mentioned answer contains "For Example" section which could be a good starting point to do such a thing. – Ahmad F Oct 08 '17 at 06:45
- 
                    Thanks for the example. I'm unable to get it. I got one outlet label in VC_A and it contains a subView. the thing is, suBView want's to know the value of VC_A label value. ( here subView is also in VC_A). – Girija Alluri Oct 08 '17 at 07:22
1 Answers
0
            
            
        Please try to use this method. I think this will be use full for you. Pass your outlet value here.
           let destVC = self.storyboard?.instantiateViewController(withIdentifier: "CategoryDescriptionViewController_id") as? CategoryDescriptionViewController
            destVC?.aTitleText = ""
            destVC?.aDescText = ""
            destVC?.view.frame = CGRect(x: 0, y: 0, width: self.view.frame.size.width, height: self.view.frame.size.height)
            self.addChildViewController(destVC ?? UIViewController())
            self.view.addSubview((destVC?.view)!)
            destVC?.didMove(toParentViewController: self)
 
    
    
        Vinay Kumar
        
- 107
- 1
- 12
- 
                    Thanks for the example. I'm unable to get it. I got one outlet label in VC_A and it contains a subView. the thing is, suBView want's to know the value of VC_A label value. ( here subView is also in VC_A). – Girija Alluri Oct 08 '17 at 07:21
