Skip to main content

Posts

Solving the problem UITextField getting hidden by the keyboard.

We need to know the timing of the keyboard showing up so that we can slide the view up, for that we have the NSNotificationCenter:  NotificationCenter . default . addObserver ( self ,  selector: #selector ( keyboardWillShow ),  name: UIResponder . keyboardWillShowNotification ,  object: nil ) So basically what this does is that it sets an observer to tell us when the keyboard is about to show.  In other words, it is as if our view controller is signing up to be notified when an event is coming up. In the code written above, when the viewController is notified of the keyboard showing, we want it to execute the function:  keyboardWillShow() @objc func keyboardWillShow ( _ notification: Notification ){         self . view . frame . origin . y = - getKeyboardHeight ( notification ) } What this function is doing is to simply shifting the view up by a distance that equals the hight of the keyboard. NSNotifications carry information in a...
Recent posts

Github personal access token as password

So, as I was working on a project required by an online course I am currently following, I hit quit an interesting problem:  I couldn't push my work to my Github repository. The reason being SourceTree kept asking for the password.  Reason: Using two factors authentication with Github requires creating a personal token and using it with SourceTree. Github documentation Step I In your Github account, click on your user name and select settings Step II   Select the Developer settings in the left sidebar Step III Select the Personal access tokens in the left sidebar Step IV  Click the Generate new token button Step V Set a name to your token and select the scope you'd like to grant StepVI  Copy the generated key and paste it as a password in SourceTree. Et voila!