Keyboard Management Notification Observers
Tinder Firestore Swipe and Match
With our screen full designed, you'll see a nagging bug that occurs when you pull up the keyboard. We'll have to account for the keyboard's size whenever its being presented by shifting our view up through a translation transformation. We'll also handle the case of dismissing the keyboard, shifting our views back to their original positions.

Comments (15)
Kevin Jefferson
4 years ago
Hello Brian, I have the exact code used as your downloaded project but the keyboard will not show and I receive this message. 2018-11-17 12:27:17.735251+0100 SwipeMatchFirestoreLBTA[69072:5349831] [MC] System group container for systemgroup.com.apple.configurationprofiles path is /Users/kevinjefferson/Library/Developer/CoreSimulator/Devices/814D4C44-425D-4952-A6FE-43E2F31F8D84/data/Containers/Shared/SystemGroup/systemgroup.com.apple.configurationprofiles 2018-11-17 12:27:17.737341+0100 SwipeMatchFirestoreLBTA[69072:5349831] [MC] Reading from private effective user settings. what needs to be done?
Kevin Jefferson
4 years ago
no need Brian got it...... :)
w_gorka
4 years ago
Hello, I have the same issue, how do you resolve it? :)
w_gorka
4 years ago
No need, I edited the scheme :)
omarubilla
4 years ago
Hi what was the fix here? Thanks
viethpham
4 years ago
Hi Brian, Thank you for the awesome video. I think there is a much better way to dismiss the keyboard is to override func touchBegan(...) on the ViewController class.
Christophe Bugnon
4 years ago
Hey Brian, I want to suggest you something. If you want to don't implement required init(), you need to create a convenience init, it doesn't need required init. Hope it helps you if you didn't know. Nice video again ! ;) It works well for me: UIView.animate(withDuration: 0.3) { self.view.transform = .identity } Have a nice day.
ZpecterZ80
4 years ago
When I touch inside the password textfield in first place, the animation has a weird effect. It goes down and then it goes up the view. How can we fix it?
Brian Voong
4 years ago
Tokyojogo
4 years ago
Hi Brian, I've downloaded the project file but I don't see any UISCrollView implementation. Right now when I click on password, the stackView kinda jumps to the top of the screen the bounces back down and settles to the desired location. Its not smooth at all.
Brian Voong
4 years ago
ZpecterZ80
4 years ago
Hi Brian, Finally I have found a solution for this problem. For some reason, the first time the difference variable is calculated, the resulted value is negative, so, it's enough to check if this value is higher than 0 to apply the animation.
stonypig1
4 years ago
it is ok not allowing download these videos for preventing piracy, but is it possible to enable the video buffer function ? I pause the video long time in Starbucks, wish it will buffer in memory, it is still lag , I believe there is no buffer enable.
Brian Voong
4 years ago
stonypig1
4 years ago
Great news to hear, thanks
Eduardo Davila Nadal
4 years ago
That would be a great next course... so we learn how the app we will use was builded!!
Ignatius Cheng
4 years ago
Hi Brian, I have the same buggy issues like others below. Then, I realized that the problems only came up for Iphone XR, including the keyboard doesn't pop up for full name and email blanks and the password blank comes up and bounce back immediately. I wonder how to sort out this issue. Thanks :)
Alex Vaiman
4 years ago
hey there is a small bug. it should be something like if diffrence -padding < {return}// cold be the case on large screens
Shaq Noir
4 years ago
Hi Brian, my app was being buggy following this lesson, in pretty much the same way as described below. When I click on 'full name' or 'email' textfields, no keyboard pops up, and when I click on 'password' textfield, the keyboard briefly pops up then disappears in a very buggy manner. After being unsure how to fix this bug, I decided to download the project for this lesson.. but the bug persists! Here are the errors: 2019-02-24 13:29:17.155841+0000 SwipeMatchFirestoreLBTA[75357:24785509] API error: <_UIKBCompatInputView: 0x7fc130d0e5e0; frame = (0 0; 375 233); layer = <CALayer: 0x600000faa020>> returned 0 width, assuming UIViewNoIntrinsicMetric 2019-02-24 13:29:17.293504+0000 SwipeMatchFirestoreLBTA[75357:24785811] [AutoFill] Cannot show Automatic Strong Passwords for app bundleID: com.letsbuildthatapp.SwipeMatchFirestoreLBTA due to error: iCloud Keychain is disabled any suggestion on how to fix ? I imagine it's something to do with my own settings on xCode... ?
Brian Voong
4 years ago
9.09
4 years ago
Hi Brian, I have a problem with my code, I have 3 errors and they say: Type 'UIResponder' has no member 'keyboardWillShowNotification' Type 'UIResponder' has no member 'keyboardWillHideNotification' Type 'UIResponder' has no member 'keyboardFrameEndUserInfoKey' This is my first xcode course so, I would really love to understand what's going on. I hope you can reply. Have a great day! And congrats for all this great material!!
Brian Voong
4 years ago
Bobby Chang Liu
4 years ago
Wrap transform inside UIView animate seems not making any difference and the duration argument does work according to this post [https://stackoverflow.com/questions/17681109/uiview-animation-ignores-duration] I got the following code and the dismiss still happens within a second. The delay works though. ```swift UIView.animate(withDuration: 100, delay: 3, options: UIView.AnimationOptions.curveEaseOut, animations: { self.view.transform = .identity }) ```
petar7
4 years ago
Hi Brian, this course is amazing , it is worth every cent! Thank you master keep doing awesome stuff because i am here to buy it haha :)
MIkeb
4 years ago
when I run this code on Xs or 8 simulator the keyboard pops up and works fine. If I try to run this same code on X or Xr it does not work, the keyboard does not pop up. I also ran your UIScrollView Keyboard Auto Scrolling project and it did not work on XR or X simulator either..... I guess I should just continue the lesson using XS to test?
Brian Voong
4 years ago
malrhex
4 years ago
It doesn't work at all on Iphone X, It just gives me a blackScreen with the gradiant on the place of the keyboard and nothing else. no keyboard at all, no registerVC.
malrhex
4 years ago
I mean, when I click on any textField... to show up the keyboard
Brian Voong
4 years ago
malrhex
4 years ago
Both Iphone X simulator and Real Device it's negative. Simulator doesn't show the keyboard and real device gives me 70% black 30% of the gradient colors. Kinda weird. It works nice and smooth on Xs & Xr, but the XsMax has some bump on the top as a black screen for a little bit on the simulator. That's all the feedback that I can give you.
malrhex
4 years ago
I am really sorry Brian, My bad, I didn't delete one of the stackViews that were on setupLayout, that you converted on Lazy var... so.. Disregard. Really sorry bro.
malrhex
4 years ago
Brian, do you know how to refresh the navBar change its title color while fetching values from firebase without change the view hierarchy title color? only the current view? I tried this navBar?.titleTextAttributes = [NSAttributedString.Key.foregroundColor:UIColor.purple] navBar?.setNeedsDisplay() navBar?.layoutIfNeeded() self.collectionView.reloadData() self.collectionView.setNeedsDisplay() self.collectionView.layoutIfNeeded() also with UIView.animateSpr.. or dequeue to mainThread.. but only changes after I click back button
Brian Voong
4 years ago
malrhex
4 years ago
haha a rabbit hole! thanks man! appreciate it a lot! let's start diggin'
Christopher J. Roura
3 years ago
Hi Brian and others, A few of us have noticed issues with this keyboard management approach. I don't think Brian's code is at fault. I think Apple themselves don't do a great job with keyboard management and I wish it is something they would make easier and more streamlined for us devs. Each I have found a hacky solution to the password "glitch" issue. With that being said it produces another issue i can't seem to resolve. When a user clicks on the password field once it works as expected with the below code (with no glitches). If a user clicks off of it and clicks the password text field immediately after the screen then the screen bounces down "glitches" and then animates back up. Throughout my research i have noticed it may be due to the icloud keychain suggestion area not being recognized and therefore we cannot appropriately calculate the correct height. To be honest I have struggled with this and if anyone has any idea or any solution i would love to know. let difference = keyboardFrame.height - bottomSpace if difference < 0 { self.view.transform = CGAffineTransform(translationX: 0, y: difference + 8) } else { self.view.transform = CGAffineTransform(translationX: 0, y: -difference - 8) }
Christopher J. Roura
3 years ago
Just to add, the more common approach i found throughout most major apps is to animate up once the textfield is hit and then not provide any animation down. This approach causes no bugs but in my opinion isn't as user friendly.
HELP & SUPPORT