Swift: Firebase 3 - Logging in with Email and Password (Ep 3)

Swift: Firebase 3 - Logging in with Email and Password (Ep 3)

Lets Build That App

8 лет назад

69,235 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

@alekseiwe
@alekseiwe - 29.07.2017 12:51

Thank you, Brian, for your great work!

Ответить
@TestThenPush
@TestThenPush - 01.08.2017 22:44

I am using xcode8.1 and swift 3 and self.dismiss(animated: true, completion: nil) method is not working in handleLogin() and handleRegister() methods . Can you tell me what will be the problem?

Ответить
@트래블스피킹TravelSpeaki
@트래블스피킹TravelSpeaki - 06.08.2017 23:56

I still do not get it why we need lazy var for loginRegisterSegmentedControl variable in the code after seeing the video for lazy var explanation. Would you give me a brief explanation that why we need lazy var in this case? Thank you!

Ответить
@QuangNguyen-tb7ee
@QuangNguyen-tb7ee - 09.08.2017 03:32

// user is not logged in
if Auth.auth().currentUser?.uid == nil {
logOut()
}

what are all these things mean? guys? It's in the viewDidLoad()

Ответить
@SurgedGraphics
@SurgedGraphics - 10.08.2017 02:05

Dude thank you for explaining it all in code. It shows me that doing it in code is much less daunting than I thought. I appreciate all your help

Ответить
@uzielfedor5077
@uzielfedor5077 - 10.08.2017 11:17

Hi, Great Video!!! If I switch to my iPad Pro, and even iphone 7 plus, my subviews all collide together, how can I keep that from happening? Or How can I keep it so that it looks similar on other device sizes? Thank you!

Ответить
@coolzoa
@coolzoa - 16.08.2017 15:56

Can someone plz help me? When I try to run the app i get the message of "unable to simultaneously satisfy constraints"

Ответить
@dimoreno9398
@dimoreno9398 - 26.08.2017 07:11

HI Brian I have 11 uitextfield I am trying to add a scrollview like this
let scrollView: UIScrollView = {
let pantalla : CGRect = UIScreen.main.bounds
let pw = pantalla.width
let ph = pantalla.height
let sv = UIScrollView(frame: CGRect(x: 0, y: 120, width: pw, height: ph))//I don't know if it is good
sv.translatesAutoresizingMaskIntoConstraints = false
return sv
}()

and after that I do this:
view.addSubview(scrollView)
let pantalla : CGRect = UIScreen.main.bounds
let pw = pantalla.width
let ph = pantalla.height
scrollView.isScrollEnabled = true
scrollView.contentSize = CGSize(width: pw, height: ph)
scrollView.addSubview(inputContainer)

scrollView.leftAnchor.constraint(equalTo: view.leftAnchor).isActive = true
scrollView.topAnchor.constraint(equalTo: view.topAnchor).isActive = true
scrollView.rightAnchor.constraint(equalTo: view.rightAnchor).isActive = true
scrollView.bottomAnchor.constraint(equalTo: view.bottomAnchor).isActive = true

But I can't scroll How can I fix this?

Ответить
@elionderiu2001
@elionderiu2001 - 26.08.2017 17:10

Lets Build That App 1 year has passed since this video tutorial and most of the code no longer works.
This is a good reason to use the storyboard

Ответить
@sanjitraman
@sanjitraman - 30.08.2017 14:29

Here is the solution for the nameTextField still showing for Swift 3:
replace nameTextField Code with this:

nameTextFieldHeightAnchor?.isActive = false
nameTextFieldHeightAnchor = nameTextField.heightAnchor.constraint(equalTo: inputsContainerView.heightAnchor, multiplier: loginRegisterSegmentedControl.selectedSegmentIndex == 0 ? 0 : 1/3)
nameTextFieldHeightAnchor?.isActive = true
nameTextField.alpha = loginRegisterSegmentedControl.selectedSegmentIndex == 0 ? 0 : 1

Ответить
@StephenRayner
@StephenRayner - 09.09.2017 01:01

Seeing a small glimpse of the main screen before the login screen is shown seems a little tacky. Is there not a better way to do this from AppDelegate?

Ответить
@Llink4n
@Llink4n - 14.09.2017 13:30

Can you show us some advices to increase the speed of compiling and build process please ? Think you for the great videos. Best

Ответить
@Zeng.Lawrence
@Zeng.Lawrence - 20.10.2017 05:22

It's such a great tutorial. I really like your style. Thanks!

Ответить
@mark-ti9hj
@mark-ti9hj - 23.10.2017 07:55

Can I get your number?

Ответить
@ebenandoh-kesson5904
@ebenandoh-kesson5904 - 03.11.2017 22:19

can you please help me with sendUser email verification

Ответить
@tezelyusuf
@tezelyusuf - 05.11.2017 23:04

People if you want to do it programmatically (trust me after couple of apps you will), then use SnapKit for constraints
.

Ответить
@EangChenn
@EangChenn - 10.11.2017 19:49

I like your style of coding. Support 100%

Ответить
@vijaytanala5792
@vijaytanala5792 - 05.12.2017 08:18

can you provide the complete source code for chatapp?

Ответить
@fouritity
@fouritity - 28.12.2017 05:19

“But just because you are doing something faster doesn't necessarily mean it's better” -- Brian Voong, great quote, and No, I don't seem to follow, LOL

Ответить
@tremainegrant7033
@tremainegrant7033 - 17.01.2018 16:26

I have a question regarding logging in and fetching the current users data. I watched one of your other videos on singletons and the gap I see is fetching a user, and setting their properties in your singleton once, but then being able to access that current users data anywhere from the app. With the fetch user being asyc how do ensure that fetch user is only ran once at the beginning of the application and set the object to all the users properties. The problem I am facing is that I would rather run make the fetch user function private and call it within the singleton and then set the instance, however this doesn't work do it being async, I need the app to wait until that current user singleton is loaded before proceeding.

Ответить
@nerdienummies8243
@nerdienummies8243 - 18.01.2018 03:21

Hey Brian! What's up? I was wondering if you have though of doing a PhoneAuth firebase swift 4 video?

Thanks for your awesome vids,
Nerdie

Ответить
@corn9189
@corn9189 - 04.02.2018 16:33

Hello Brain, thanks to your great tutorial Video.
I made Login View by Interface Builder and i saw your UITextView auto sizing video
and i combine these together.
I wrote this code for change Login / Register TextField

@objc func segmentedIndexChanged(){
if segmentControl.selectedSegmentIndex == 0 {
registerBtn.setTitle("Login", for: .normal)
textFieldStackView.removeArrangedSubview(nameTextField)
textFieldStackView.removeArrangedSubview(nameSeparator)
stackViewBackgroundView.constraints.forEach({
if $0.firstAttribute == .height {
$0.constant = 101
}
})
textFieldStackView.distribution = .fill
}else if segmentControl.selectedSegmentIndex == 1 {
registerBtn.setTitle("Register", for: .normal)
stackViewBackgroundView.constraints.forEach({
if $0.firstAttribute == .height {
$0.constant = 152
}
})
textFieldStackView.insertArrangedSubview(nameTextField, at: 0)
textFieldStackView.insertArrangedSubview(nameSeparator, at: 1)
textFieldStackView.distribution = .fill
}
}

Is this fine? or is this totally wrong code?

Ответить
@cristiarad100
@cristiarad100 - 08.02.2018 16:08

Hi man! Thanks for the videos. I am currently working on my dissertation and i find your videos veeeery helpful because i also want to implement such Login/Register functionality in my app. Thanks again!

Ответить
@nooralamshaikh3878
@nooralamshaikh3878 - 09.02.2018 00:00

how to login with data from database? like in my project i want to make user login with username not email

Ответить
@LynxSavage
@LynxSavage - 10.02.2018 20:26

I started off in storyboards and they drove me nuts. Not to mention they worked really slowly on my computers. Watching your videos I have started rewriting my current apps programmatically and I am not looking back. So much faster.

Ответить
@mindspanconsultants
@mindspanconsultants - 05.03.2018 04:11

Great that you can code interface elements -- always nice to know what is going on under the hood; however, Storyboards are the way to go. Just like nobody expects people to manually code PDFs when they can use a tool with a GUI like Illustrator, Storyboards are the present and future of interface development in Xcode. Further, if you are working on a team, it is much easier to demonstrate the UI and tweak it live based on feedback using storyboards.

Ответить
@jimmyporter8941
@jimmyporter8941 - 18.04.2018 08:00

It would have been better to set the height constraint of inputsContentView on it's contents, rather than the other way around.

And of course now you wouldn't do any of that, you'd use a stack view.

Ответить
@cabrahamrv11
@cabrahamrv11 - 22.04.2018 18:59

great video

Ответить
@jackshihtaken
@jackshihtaken - 22.05.2018 07:53

Code is better in this case, clearly.

Ответить
@sajjadparmar354
@sajjadparmar354 - 31.05.2018 13:37

your All video on Firebase very Good ..2 good.....please upload video on Slidebar without using Segues.......... Thank you:)

Ответить
@Krogers011
@Krogers011 - 08.06.2018 05:25

The UI button on the login page stops working after I toggle the segmented control to "login", any suggestions on a fix? common problem?

Ответить
@kevinpeng7219
@kevinpeng7219 - 04.08.2018 15:21

I support programmatic UI! Programmatic UI rocks, Brian!

Ответить
@Michael-xe5mm
@Michael-xe5mm - 12.10.2018 10:22

i think it would be better with a vertical stackview. it is only neccassery to set the nametextfield height.

Ответить
@CuriosMindDIY
@CuriosMindDIY - 21.11.2018 07:14

Basically, I made the Login & Register on 2 different views, I didn't use the segmented control, upon clicking on a button on RegisterVC , doing "self.present(loginVC....etc", I manage to get to LoginVC, while Logging in the user, when I try do dismiss, it takes me back to the RegisterVC, what should I do to get in the chat? Please help!

Ответить
@BondedSeven
@BondedSeven - 28.12.2018 21:56

in handleRegister, you use self.dismissViewController instead of present to show ViewController.swift on the screen. I tried the present method and its just a blank tableview (the user's name is not at the top and the "Logout" is not at the top left. How come that does not work?

let vc = ViewController()
present(vc, animated: true, completion: nil)

Ответить
@wahaxoxo
@wahaxoxo - 30.01.2019 02:37

Using code to design interface is really pain in the a** ! by the way nice tutorial.

Ответить
@amalvatsa9050
@amalvatsa9050 - 20.02.2019 15:41

when I login in the app it give a blink at the login page and then comes to the activity page

Ответить
@petersison7804
@petersison7804 - 27.05.2019 09:59

Looks like quite a lot of people are encountering this similar issue with Login/Sign-in error "email already in use" caused by outdated code, presented in this tutorial. How do we get a hold of the updated swift 4.2 code? Do we have to pay?

Ответить
@andrewdavies5722
@andrewdavies5722 - 31.05.2019 16:31

Your videos are great! Doing things programmatically should always be where to start. It gives a vital understanding of the basics you might miss using storyboards from the off + as an engineer code is <3

Ответить
@avisaposhtkouhi9201
@avisaposhtkouhi9201 - 15.06.2019 09:32

I am a big fan of doing pragmatically for UI. Its more accurate
and professional and easy too modified. I say goodbye for good to storyboard.

Ответить
@danayessentay2439
@danayessentay2439 - 30.07.2019 14:24

hello, Brian.

Thanks a lot for the tutorials. You are awesome!!
But is there any way to implement Secure Password policy into your code?
For example I want my users to have at least 8 characters long password.

Thanks you again.

Ответить
@thenightfox2431
@thenightfox2431 - 11.02.2020 10:47

I thought it would be a fun challenge to try to follow this tutorial on the newest version of Xcode. It's driving me nuts though. The dismiss doesn't work.
instead of that im using navigationController.pushViewController .... but the logout button goes away after registering!!!! I might have to create a button manually








Please help

Ответить
@curt8806
@curt8806 - 15.03.2020 05:48

How do you make session last forever so no multiple logins ?

Ответить
@longarinas
@longarinas - 10.04.2020 16:34

For whose are using swift 5.x, you must use viewDidAppear :


override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(true)

if Auth.auth().currentUser?.uid == nil {
handleLogout()
}else{
setupNavigationItem()
}
}

Ответить
@brckhmptn
@brckhmptn - 22.05.2020 16:54

In this episode, Brian explains why programmatic code is better than storyboards.

Ответить
@samuelpmilanez
@samuelpmilanez - 09.07.2020 16:08

Hey man, using the programmatic user interface, I feel the boundary between the View and the Controller is discreet, unnoticeable. Because using storyboard, it is very easy to separate the .storyboard files from the .swift files, and therefore the MVC ideal becomes clearer. But I love making the interfaces programmatically!

Ответить
@MultiSimransingh
@MultiSimransingh - 02.08.2020 13:51

Putting handleLogout in Delay is a good trick, but do you think you could have also used dispatchQueue.main.async? But great tutorial.. I always learn something new when I see your videos. I hope you live another 100 years and keep doing these tutorials. Thanks.

Ответить