I'm practicing by building a simple app with 20 .txt files that I have add to the app. Here's what I have so far:

1. Created tableviewcontroller with nav embedded and a detail view
2. List the titles of the .txt files with filemanager in tableview

I'm stuck on trying to load the .txt files into textview when a .txt tile is selected. I tried using a func load but then get stuck on how to call load when .txt title is selected. Can anyone help or link me to something that explains this?

Ideally I'd like to add .txt files in a way that allows more flexibility than just adding text bodies. These are poems in a foreign language and I'd like to add translations after each line that can toggled on and off. Anyone know how I could that and if the direction I've taken so far is the best way to get there? Should I be calling the files in some other way?

Here is my view controller:

```
import UIKit

class ViewController: UITableViewController {
    var hymns = [String]()

    override func viewDidLoad() {
        super.viewDidLoad()

        let fm = FileManager.default
        let path = Bundle.main.resourcePath!
        let items = try! fm.contentsOfDirectory(atPath: path)

        for item in items {
            if item.hasSuffix(".txt") {
                hymns.append(item)
            }
        }
    }

    override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        return hymns.count
    }

    override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
        let cell = tableView.dequeueReusableCell(withIdentifier: "Hymn", for: indexPath)
        cell.textLabel?.text = hymns[indexPath.row]
        return cell
    }

    override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
        if let vc = storyboard?.instantiateViewController(withIdentifier: "Detail") as? DetailViewController {
            vc.selectedHymns = hymns[indexPath.row]
            navigationController?.pushViewController(vc, animated: true)
        }
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }

And this is my detailViewController so far:
import UIKit

class DetailViewController: UIViewController {

    @IBOutlet weak var textView: UITextView!

    var selectedHymns: String?
    var hymnText = [String] ()

    override func viewDidLoad() {
        super.viewDidLoad()

        if let textToLoad = selectedHymn {
            if let hymnText = load(file: textToLoad){
            textView.text = hymnText
        }

    }
    }

    func load(file name:String) -> String {
        if let path = Bundle.main.path(forResource: name, ofType: "txt") {
            if let contents = try? String(contentsOfFile: path) {
                return contents
            } else {
                print("Error! - This file doesn't contain any text.")
            }
        } else {
            print("Error! - This file doesn't exist.")
        }
        return ""
    }
}

```