How to write Keyboard notifications in Swift 3
<p>I'm trying to update this code to swift 3:</p>

<pre><code>NSNotificationCenter.defaultCenter().addObserver(self, selector: Selector("keyboardWillShow:"), name: UIKeyboardWillShowNotification, object: nil)

NSNotificationCenter.defaultCenter().addObserver(self, selector: Selector("keyboardWillHide:"), name: UIKeyboardWillHideNotification, object: nil)`
</code></pre>

<p>So far, I've just tried the auto corrections given by the compiler. This results in code like this:</p>

<pre><code>let notificationCenter = NotificationCenter.default()
notificationCenter.addObserver(self, selector: Selector(("keyboardWillShow:")), name: NSNotification.Name.UIKeyboardWillShow, object: nil)

notificationCenter.addObserver(self, selector: Selector(("keyboardWillHide:")), name: NSNotification.Name.UIKeyboardWillHide, object: nil)`
</code></pre>

<p>Unfortunately, that doesn't take me far, resulting in additional errors.</p>

<p>Has anyone solved this please? </p>

<p>Please note that I'm just trying how to write the notifications. I'm not (yet) trying to fix the notification functions.. Thanks</p>