title: open text files in same ViewController
body: <p>I am making app for iPhone in Xcode using Swift i have added multiple buttons on Main.Storyboard and there is one txt file for each Button, Like</p>
  
  <pre><code> class ViewController: UIViewController {
  
      @IBAction func Button1(_ sender: Any) {
  
             opneTextFile(fileName: "example")
         }
         @IBAction func Button2(_ sender: Any) {
  
             opneTextFile(fileName: "example1")
  
         }
  override func viewDidLoad() {
          super.viewDidLoad()
          // Do any additional setup after loading the view.
      }
  
      func opneTextFile(fileName : String) {
  
          if let filepath = Bundle.main.path(forResource: fileName, ofType: "txt") {
              do {
                  let contents = try String(contentsOfFile: filepath)
                  print(contents)
                  //  Now push second ViewController form here with contents.
                     if let secondVC = self.storyboard?.instantiateViewController(withIdentifier: "TextViewVC") as? TextViewVC {
                      secondVC.content = contents
                      self.navigationController?.pushViewController(secondVC, animated: true)
                  }
              } catch {
  
                  // contents could not be loaded
              }
          } else {
              // example.txt not found!
          }
      }
  </code></pre>
  
  <p>This Is My TextViewVC and i have create a new ViewController in storyboard with TextView and linked it with TextViewVC file</p>
  
  <pre><code>class TextViewVC: UIViewController {
  
       @IBOutlet var textView: UITextView!
       var content : String?
  
      override func viewDidLoad() {
          super.viewDidLoad()
  
          textView.text = content
  
          // Do any additional setup after loading the view.
      }
  </code></pre>
  
  <p>Error</p>
  
  <p><a href="https://i.stack.imgur.com/lqNji.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/lqNji.png" alt="enter image description here"></a></p>
  
  <p>but i don't know how to open file when user click on button, it should be something like when user click on button1 the txt1 file should open in ViewController2 and when user click on button2 the txt2 file should open in Same when user click on button1 the txt1 file should open in ViewController as Button1 and the same for rest Buttons..</p>