Use NotificationCenter to add Observer in swift 3
<p>I understand that the NotificationCenter has changed, and I have looked up how to change it to the new implementation, using this link:  <a href="https://stackoverflow.com/questions/38204703/notificationcenter-issue-on-swift-3">NotificationCenter issue on Swift 3</a>, but i still cannot get mine to work! I am doing an assignment from my class using the class text book and this is my class so far:</p>

<pre><code>//
//  ViewController.swift
//  Persistence
//
//  Created by Skyleguy on 10/31/16.
//  Copyright © 2016 Skyleguy. All rights reserved.
//

import UIKit

class ViewController: UIViewController {

    @IBOutlet var lineFields: [UITextField]!

    override func viewDidLoad() {
        super.viewDidLoad()
        let filePath = self.dataFilePath()
        if (FileManager.default.fileExists(atPath: filePath))
        {
            let array = NSArray(contentsOfFile: filePath) as! [String]
            for i in 0 ..&lt; array.count
            {
                lineFields[i].text = array[i]
            }
        }

        let notificationName = Notification.Name("applicationWillResignActive")
        NotificationCenter.default.addObserver(self, selector: #selector(Persistence.applicationWillResignActive(notification: NSNotification)), name: notificationName, object: nil)
        // Do any additional setup after loading the view, typically from a nib.
    }

    func applicationWillResignActive(notification: NSNotification)
    {
        let filePath = self.dataFilePath()
        let array = (self.lineFields as NSArray).value(forKey: "text") as! NSArray
        array.write(toFile: filePath, atomically: true)
    }
}
</code></pre>

<p>after all of this I am still getting an error:</p>

<p>"Module "Persistence" has no member named 'applicationWillResignActive'"</p>

<p>please help!</p>