Please rate your Swift MVVM implementation : <p>I would like to be evaluated to ensure that Swift MVVM is implemented correctly.</p>

<p>Also, if there is anything else that can be supplemented, please modify it.</p>

<h1>1. AppDelegate.swift</h1>

<p>Before the ViewController is displayed, AppDelegate specifies a ViewModel.</p>

<pre><code>   func application(_ application: UIApplication, 
    didFinishLaunchingWithOptions launchOptions: 
   [UIApplication.LaunchOptionsKey: Any]?) -&gt; Bool {

    if let rootVC = window?.rootViewController as? ViewController {
        rootVC.viewModel = MainViewModel()
    }

    return true
}
</code></pre>

<h1>2. ViewController.swift</h1>

<p>Perform DataBinding in the ViewController. 
TableView is also specified using extension.</p>

<pre><code>class ViewController: UIViewController {

var viewModel: MainViewModel!

override func viewDidLoad() {
    super.viewDidLoad()

    viewModel.bind { [weak self] in
        DispatchQueue.main.async {
            print("TableView reloadData")
                // tableView reload
        }
    }

    viewModel.addText(addText: "test")
    print("count \(viewModel.count)")
  }
}

class TextListCell: UITableViewCell {

}

extension ViewController: UITableViewDataSource {
func tableView(_ tableView: UITableView, numberOfRowsInSection             section: Int) -&gt; Int {
    return viewModel.count
}

func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -&gt; UITableViewCell {
    let cell: TextListCell = tableView.dequeueReusableCell(withIdentifier: "TextListCell", for: indexPath) as! TextListCell

    let test = viewModel.texts[indexPath.row]

    return cell
  }
}

extension ViewController: UITableViewDelegate {

func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
    print("\(indexPath.row.description)")
   }
}
</code></pre>

<h1>3. MainModel.swift</h1>

<p>Model is known as Data Management.
However, I don't understand that the Business Logic is being handled by a model.</p>

<pre><code>struct TextEditor {
let text: String
}
</code></pre>

<h1>4. MainViewModel.swift</h1>

<p>After the model update, inform the ViewModel of the results and prepare the data to be displayed in View.</p>

<pre><code>protocol MainViewModelProtocol: class {
func bind(didChange: @escaping () -&gt; Void)
func addText(addText: String)
var count: Int { get }
var texts: Array&lt;TextEditor&gt; { get }
}

class MainViewModel: MainViewModelProtocol {
private var didChange: (() -&gt; Void)?

var texts: [TextEditor] = [] {
    didSet {
        didChange?()
    }
}

func bind(didChange: @escaping () -&gt; Void) {
    self.didChange = didChange
}

var count: Int {
    return texts.count
}

func addText(addText: String) {
    self.texts.append(TextEditor(text: addText))
}
}
</code></pre>
