Тёмный

Complete SwiftUI Firebase Tutorial: Auth, Sign Up Page, Cloud Firestore, Read & Write Data 

Logan Koshenka
Подписаться 4,3 тыс.
Просмотров 67 тыс.
50% 1

This SwiftUI Firebase Tutorial walks you through how to use Firebase Auth (Authentication) and Firebase Cloud Firestore with SwiftUI to create a sign up page, read / fetch data, and write to a database using a swiftui list view. SwiftUI is one of the best ways for beginners to learn how to create their own app in iOS / Swift. You will need Xcode to complete this tutorial.
I encourage you to follow along in this video, but if you want the source code, it can be found here:
logankoshenka....
Want to see more? Check out these videos:
The Story Behind My New App: • I Turned This Life-Cha...
How I'd Learn to Code Today: • How a Senior iOS Engin...
RevenueCat / In-App Purchases Tutorial: • Easily Make Money with...
Follow me and say hello!
Instagram: / logankoshenka
Twitter: / logankoshenka​
#SwiftUI #Firebase #Tutorial #XCode #iOSDeveloper

Опубликовано:

 

12 сен 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 192   
@logankoshenka
@logankoshenka 2 года назад
Here is the code snippet for 03:30: extension View { func placeholder( when shouldShow: Bool, alignment: Alignment = .leading, @ViewBuilder placeholder: () -> Content) -> some View { ZStack(alignment: alignment) { placeholder().opacity(shouldShow ? 1 : 0) self } } }
@walterzz-d1y
@walterzz-d1y 2 года назад
Some time small creator are more helpful than big creator thanks for the knowledge I really appreciate.
@logankoshenka
@logankoshenka 2 года назад
thanks so much!
@SF-gn6uw
@SF-gn6uw Год назад
My god it works…. Your voice is strong enough to carry this without background music
@logankoshenka
@logankoshenka Год назад
noted 💪
@thelambsauce2015
@thelambsauce2015 2 года назад
This tutorial is very on point and straightforward. Thank you so much for this!
@logankoshenka
@logankoshenka 2 года назад
glad you enjoyed it!
@NavdeepSingh-ut8md
@NavdeepSingh-ut8md 7 месяцев назад
Great brother, such an important topic and you made it look so easy !!.
@ElleCapitan
@ElleCapitan 11 месяцев назад
Hey Logan, fantastic tutorial. Also helps that my daughter and you share a great name! Hope to see more from you!
@logankoshenka
@logankoshenka 11 месяцев назад
No way! Happy to help! Just add .environmentObject(DataManager()) to your ListView() inside of your preview code!!
@wiktorwysocki516
@wiktorwysocki516 Год назад
Great tutorial, just what I was looking for! Thank you!
@logankoshenka
@logankoshenka Год назад
great!
@HasxVoiks
@HasxVoiks Год назад
These videos are literally the most helpful thing i've come across, thank you for everything Logan
@logankoshenka
@logankoshenka Год назад
love hearing that, thanks for watching!
@HasxVoiks
@HasxVoiks Год назад
@@logankoshenka Can't wait for the next video!
@logankoshenka
@logankoshenka Год назад
tomorrow!
@ggmptv7904
@ggmptv7904 8 месяцев назад
Amazinfg content, not boring, the code works and I applied what I learned to my own code and now understand what's going on a lot better! Thank you
@logankoshenka
@logankoshenka 8 месяцев назад
love that!! thanks for watching & commenting!!
@NIXO3D
@NIXO3D 11 месяцев назад
Man, this video is gold ✨ Thank you so much, you made it so simple for me and it helped me so much, thank you so much. I subscribed. keep rocking 🍻
@logankoshenka
@logankoshenka 11 месяцев назад
great to hear! thanks! 🤝
@SOK-gn6hw
@SOK-gn6hw 2 года назад
i was subscribe another channels who are making videos about swiftui but after this video i delete them all !! Nice job.
@logankoshenka
@logankoshenka 2 года назад
haha glad to have you here!!
@bald_agent_smith
@bald_agent_smith Год назад
Thanks for the clear explanation! Firebase looks like a handy thing when you don't want to set up the backend
@logankoshenka
@logankoshenka Год назад
Glad you liked it - and yeah, I rely on Firebase heavily!
@bald_agent_smith
@bald_agent_smith Год назад
@@logankoshenka 👍
@TheBishopOfBarton
@TheBishopOfBarton Год назад
Very useful tutorial - and it worked! Just wish there wasn't any background music - bit distracting. But found the tutorial very helpful. Thank you.
@logankoshenka
@logankoshenka Год назад
Noted - thank you!!
@Palalune
@Palalune 2 года назад
Thanks for making these videos, Orlando, I've learned a lot. Totally weird that Legolas is doing SwiftUI videos, though ...
@logankoshenka
@logankoshenka 2 года назад
😂😂😂
@stevem2878
@stevem2878 Год назад
really appreciate your video man! great job taking the time and effort on this. awesome content
@logankoshenka
@logankoshenka Год назад
thanks, glad you like it!
@jmd62800
@jmd62800 9 месяцев назад
Fantastic, i really love it , it’s beautifull, well explained for my little brain , i understand 90% in one read, Very pleasant, i’am happy thanks a lot 😊
@rubensiman8749
@rubensiman8749 Год назад
Can you make a mini series on this, we would all love it!
@logankoshenka
@logankoshenka Год назад
good idea! what else would you like to see?
@rubensiman8749
@rubensiman8749 Год назад
Man I wasn’t ready for this but here are a few 1) How to make a mini game 2) Going over your favorite third party programs that can be integrarte into XCode such as Rive, Google maps..etc 3) How to add payment or subscription base app 4) How to connect app to an website * I have look for this in RU-vid and haven’t found a good video yet. I like your videos and I think you can actually explain this in a way we can all understand
@logankoshenka
@logankoshenka Год назад
awesome thank you!
@mr.r3253
@mr.r3253 2 года назад
Amazing.. someday this channel would be big
@logankoshenka
@logankoshenka 2 года назад
thank you! I’m trying 🤞
@BananaPajamaGamer
@BananaPajamaGamer Год назад
Nice Video Logan, very easy to follow
@logankoshenka
@logankoshenka Год назад
thank you!
@kibugenzaking3473
@kibugenzaking3473 Год назад
keep it up, This is really great! keep the good work going
@logankoshenka
@logankoshenka Год назад
thank you 🙏
@editavatar6423
@editavatar6423 7 месяцев назад
Amazing stuff, great job man!
@logankoshenka
@logankoshenka 7 месяцев назад
thanks for watching 🤝
@x9v178
@x9v178 Год назад
King! Thanks so much for this awesome tutorial, helped me so much :D
@logankoshenka
@logankoshenka Год назад
glad you liked it!
@x9v178
@x9v178 Год назад
@@logankoshenka One question, what goes in the else statement in the var body: some View { in ContentView?
@logankoshenka
@logankoshenka Год назад
my code has: var body: some View { if userIsLoggedIn { ListView() } else { content } } (with "content" containing everything inside of the ZStack)
@x9v178
@x9v178 Год назад
@@logankoshenka Awesome, tysm!
@TheAshokWB
@TheAshokWB 2 года назад
Love to see your channel growing ! 😊 Don’t forget me when your channel hits 100k landmark !
@logankoshenka
@logankoshenka 2 года назад
means the world - thank you!!!
@bobbrysonn
@bobbrysonn Год назад
You made it so easy!
@IruAndOpa
@IruAndOpa 7 месяцев назад
Nice....great video
@logankoshenka
@logankoshenka 7 месяцев назад
thank you!
@AlexanderWebster_
@AlexanderWebster_ 3 месяца назад
Hey! Really appreciate the video. How are you highlighting view frames in your preview?
@logankoshenka
@logankoshenka 3 месяца назад
I know it’s changed since the video but I’m pretty sure you still can - click on the container in code while preview is on the cursor-highlighted mode (not the play button but the cursor) … might have to play around a bit but I think that should do it
@kadeus
@kadeus Год назад
Great content and easy to understand
@logankoshenka
@logankoshenka Год назад
🙏🏼
@andrejkling3886
@andrejkling3886 2 года назад
Good tutorial… thank you
@logankoshenka
@logankoshenka 2 года назад
thanks!
@andrejkling3886
@andrejkling3886 2 года назад
@@logankoshenka struct Dog should conform Hashable and in ListView for Each id:\.self. In addDog function we don't need for setData id : some Int. In this case we create in list view new name of Dog... Before with ForEach id:\.id data appear only in Firebase but in List View data appeared with same name for id : 12.
@logankoshenka
@logankoshenka 2 года назад
you’re right - good catch!
@stephaniewagstaff6563
@stephaniewagstaff6563 Год назад
First thank you for this video! Things are starting to sink in, then I got to about 21 min in and was confused by code I haven't seen before. I looked to firebase documents to explain and define what's happening with these lines and words and can't seem to find a straight forward answer, so I was wondering if you had a certain link in mind when you said to look there that you might share. Thank you so much.
@logankoshenka
@logankoshenka Год назад
you should be able to read all about Firebase Firestore here! firebase.google.com/docs/firestore
@arthurschilling5651
@arthurschilling5651 Год назад
Great video!! I suspect that no matter what user signs into the app, the list would always be the same. Can’t find a way to link data to specific users, so that for example each user has their own specific list of dogs. If you could point me in the right direction I’d appreciate it!
@logankoshenka
@logankoshenka Год назад
Of course - imagine an app where a user has friends or followers. All you would need to do is save that user’s list ID under “User” in firebase … when you load, you can fetch a list specific to them :)
@Giambu99
@Giambu99 Год назад
@@logankoshenka Let's say I want to make the same app except every user has its own dogs. Can I just retrieve the user ID every time I login and each time I save a new dog I just add a field like "owner_id" as if it was a relational db? So I can show the user only the dog whose owner_id is equal to his id. Or is it done in another way? I'm new to noSQL, thanks in advice :)
@HumbleHustle101
@HumbleHustle101 Месяц назад
Nice video, How do you represent custom object array in firebase cloud database?
@droopies6629
@droopies6629 Год назад
Hey, when I make multiple entries using the plus button it just uses the first one I make over and over. Example if I add a dog breed named "Dog" and make another one named "Dog 2" it'll be "Dog" "Dog" in the list instead of "Dog" "Dog2".
@stephaniewagstaff6563
@stephaniewagstaff6563 Год назад
Do you by chance have a video explaining the extension that you added. I'm still new to SwiftUI, so I wasn't able to make sense of the code, and would like to.
@logankoshenka
@logankoshenka Год назад
that extension is just so that we can have a placeholder for our text field ... it is a bit hacky, and I found it quickly when looking for a solution ... but the function returns a ZStack with the placeholder ... the placeholder also takes in some custom parameters (shouldShow: Bool, alignment: Alignment)
@leksetengah
@leksetengah Год назад
we need part 2, more deeper one, with auto generated id (UUID)
@myga77
@myga77 2 года назад
Yeeeah Just what we need
@logankoshenka
@logankoshenka 2 года назад
😁
@samuelp7847
@samuelp7847 11 месяцев назад
What’s your take on encapsulating your firebase logic in a service class? then instantiating in your view
@logankoshenka
@logankoshenka 11 месяцев назад
a common approach! just a matter of a personal preference :)
@furkannn1905
@furkannn1905 2 года назад
Hi I've got a question. Whenever I start my application I instantly go to the ListView. Isn't the purpose of this tutorial giving the user the possibility to signup and login?
@logankoshenka
@logankoshenka 2 года назад
Yes! I created the tutorial to include an automatic login … ideally the user wouldn’t have to log in every time they use the app, so I wanted to show that as well (around 15:50) … to reset this, you could change the code, or just delete the app from your simulator or device and run again!
@kaibadass3527
@kaibadass3527 Год назад
I’m a beginner iOS developer, self taught. May I know how I became like you that so easy to creating what you want? What is the best tutorial to learn?
@logankoshenka
@logankoshenka Год назад
haha just do a bunch of them! It just takes time!
@minineji7050
@minineji7050 Год назад
Great job thanks for the tutorial
@logankoshenka
@logankoshenka Год назад
thank you!
@martinthuriaux8930
@martinthuriaux8930 Год назад
Hello Logan. Very informative video! However I was wondering if you could help me with a certain problem: At 15:35, you create an if statement to see if the user is logged in. However, when I do this and run my simulation, it doesn't go to the "content" variable, but rather to where the function it sends it to if I'm logged in.
@TylerP-eu2gj
@TylerP-eu2gj Год назад
This tutorial handles this incorrectly. Try refactoring the state toggle to the login function.
@jasonduboff8432
@jasonduboff8432 Год назад
Hi this tutorial is awesome thank you!! How would you have the app update the data that's updated in the DB in real time? Would there be some loop that's running, or something that can watch it every minute it or so to trigger a function? Sorry I'm a noob but just thinking of how it could be done! Thank you for the immense help!!
@logankoshenka
@logankoshenka Год назад
no you’re fine! so most times you can read / write from your database based on a user’s action (save button, post button, tapping on a new screen to fetch data) … you can use the .onAppear method to call when your view appears, AND you can make your list refreshable to re-fetch that data … so it’s really just whatever best fits your situation 👍
@Connecteev
@Connecteev Год назад
Great tutorial. Can you please share a link to the code / github?
@logankoshenka
@logankoshenka Год назад
yes I will!
@sissiwa1128
@sissiwa1128 Год назад
@@logankoshenka when?
@phongho.design
@phongho.design Год назад
do u have a video for when user clicking on forget password in welcome screen ?? 😂
@logankoshenka
@logankoshenka Год назад
I don't but it's pretty simple to set up using Firebase documentation! Check out the section titled, "Send a password reset email" here: firebase.google.com/docs/auth/ios/manage-users
@whoisnoni
@whoisnoni 5 месяцев назад
is it ok to help me in my graduation project ? we made it with Swift storyboard , is everything works on it ?
@qianqian888
@qianqian888 Год назад
3Q so much!
@willimo8565
@willimo8565 Год назад
Hey Logan, great video, wondering if I could have a hand on turning the List(environmentobject.variable) to a ForEach loop, thanks :)
@logankoshenka
@logankoshenka Год назад
sorry for the late reply - List and a Stack / ForEach combo are pretty interchangeable! what are you trying to do?
@kstackz8249
@kstackz8249 2 года назад
great vid, is their a way to fetch the users location and home address?
@logankoshenka
@logankoshenka 2 года назад
location yes, in the form of coordinates ... look into tutorials like "swiftui mapkit" or "swiftui user location" ... you'll need to ask the user's permission first for privacy though! (also - firebase analytics can show you which countries your users are from)
@danielduggin2898
@danielduggin2898 Год назад
Is the firestore meant to be tied with the sign up feature? So, a new account is created, the firestore stores that new users information, and the login feature is what the authentication feature is for?
@logankoshenka
@logankoshenka Год назад
correct! if you're not saving any user data on firestore, it is not needed for authentication ... I like to tie the two together so when a user signs up, we're also saving their info :)
@Derplerplarry
@Derplerplarry 2 года назад
Instead of Rectangle for underline, can just use Divider()
@logankoshenka
@logankoshenka 2 года назад
You’re 100% right haha for some reason I was worried about the spacing … sometimes I’ll use Rectangle instead for more customization.
@DavidNitzscheBell
@DavidNitzscheBell 2 года назад
19:18 is that necessary? Isn't part of the feature set / benefit of Firebase that it keeps the data in your app and in firestore in sync? If you remove all each time, then won't you download *all* the data each time instead of just incremental changes?
@logankoshenka
@logankoshenka 2 года назад
totally necessary … if you don’t remove all, you’d get duplicates when you fetch! gotta clear previous use :)
@SOK-gn6hw
@SOK-gn6hw Год назад
Hey! Thanks for video. I did every thing same with you but when i try to open list view xcode says there is not enough internet connection, until then view will be offline. But the login and register part is work fine.
@logankoshenka
@logankoshenka Год назад
hmm, did you get this worked out? sorry for the late response!
@SOK-gn6hw
@SOK-gn6hw Год назад
@@logankoshenka i follow the steps on firebase and add init code to main page.
@SOK-gn6hw
@SOK-gn6hw Год назад
cant understand what is the problem exactly then i restart everything just like what firebase says
@mysticftn
@mysticftn Год назад
Hi, when making the text field you need to be precise where you press in order to open it, any idea on how to expand the surface to press ?
@logankoshenka
@logankoshenka Год назад
yes - play with .frame() modifier … try it in a few different orders, but you should be able to increase the tappable area by increasing the frame
@mysticftn
@mysticftn Год назад
@@logankoshenka i tried that aswell sadly and it just expend the area but not the tappable area
@GUAMxBOMB
@GUAMxBOMB Год назад
Would you be willing to set up a tutorial for a sign out function, I seem to be stuck at the original log in which never prompts my log-in again? Great video otherwise!!!
@logankoshenka
@logankoshenka Год назад
I should have covered that! Deleting the app from the device's home screen resets the behavior. In the mean time, this may be helpful too: stackoverflow.com/questions/37943616/firebase-sign-out-not-working-in-swift
@GUAMxBOMB
@GUAMxBOMB Год назад
@@logankoshenka I had to run a demo on it so what I did was create a new database and couldn't revert back to a log in screen I made following this instruction. I have to create a signOut function to create a full circle with this database in the weeks to come hopefully this stack overflow page can guide me to the final product! Thank you
@ItsIan.
@ItsIan. Год назад
@@logankoshenka Even after deleting the ap from the devices' home screen the user seems to stay logged in, have you had any issue with this?
@ItsIan.
@ItsIan. Год назад
I guess that's from the $State portion of it retaining the information afterwards. Thanks for the video!
@DavidNitzscheBell
@DavidNitzscheBell 2 года назад
In many tutorials with sign-in/sign-up pages, I see the sign-up page doesn't have a "confirm password" field. I thought it was a standard, best practice to have both a Password and Confirm Password field. No?
@logankoshenka
@logankoshenka 2 года назад
Yeah I agree … for the sake of this tutorial I was mainly showing the firebase aspect, but you could easily add another field and do an if / else check to see if the two passwords match before registering the user!
@thomasanderson1416
@thomasanderson1416 Год назад
I see everybody using hardcoded values for frames and offsets etc, won’t that have unpredictable results on different devices and resolutions?
@logankoshenka
@logankoshenka Год назад
yeah I think it all depends on what you’re doing, but the minWidth / maxWidth can help with that
@EvertonAmorimSilva
@EvertonAmorimSilva 4 месяца назад
Does this work by using storyboard instead?
@logankoshenka
@logankoshenka 4 месяца назад
yep! firebase code should be the same!
@DavidNitzscheBell
@DavidNitzscheBell 2 года назад
22:15 is it necessary to add `id: \.id` since you declared `struct Dog: Identifiable`? It shouldn't be needed.
@logankoshenka
@logankoshenka 2 года назад
Yes - you’re right about this one. It’s not needed. Thanks for catching that!
@DavidNitzscheBell
@DavidNitzscheBell 2 года назад
Question: if I have a Firebase application that gets a list of users and gets a list of X and a list of Y.... should I have three different data managers? or should the one data manager set up the different getDocuments and/or listeners for each collection?
@logankoshenka
@logankoshenka 2 года назад
That's probably a matter of personal preference ... I guess I would decide based on how related X is to Y, like if they're some sort of subcategory of a similar thing, maybe the same ... but the majority of the time, being explicit and using separate data managers is best ... separation of logic makes it easier to think ... that being said it's up to you :)
@viveksinghparihar1595
@viveksinghparihar1595 Год назад
I have one question related to Firebase. Will this data be available to all the users who are logged in to the Firebase? Or is this date associated to any user?
@logankoshenka
@logankoshenka Год назад
you can organize your security rules & data in a way that only allows users to access their data if you’d like! look up “firebase cloud firestore security rules” and you’ll see what you can do :)
@WhenYoureBored2
@WhenYoureBored2 2 года назад
Nice video! Does the auth code allow for the app to be closed and login to be saved? Meaning login details are persistent and the user won't have to login each time they open the app?
@logankoshenka
@logankoshenka 2 года назад
yes! that part is covered in the video!
@WhenYoureBored2
@WhenYoureBored2 2 года назад
@@logankoshenka Cool! Do you have any tips on how to log out?
@logankoshenka
@logankoshenka 2 года назад
yes! firebase has a logOut or signOut function as well … I thought I covered it here but if I didn’t, a search for “firebase swift signOut” will be the way to go 👍🏼
@WhenYoureBored2
@WhenYoureBored2 2 года назад
@@logankoshenka appreciate the help and the quick replies mate! Keep up the good work. Gained a sub 💪🏾
@logankoshenka
@logankoshenka 2 года назад
of course, thank you!
@AkimboFennec
@AkimboFennec 2 года назад
Does realm have a built-in authentication like Firebase. Also since i learnt mongodb, is Realm better than firebase?
@logankoshenka
@logankoshenka 2 года назад
I’m not sure if they do or not … I wouldn’t say Realm is better, but I guess it depends on your needs. I used Firebase more so I’m more comfortable w that, but it kinda comes down to needs & personal preference
@dokajunior
@dokajunior 2 года назад
About the Dog file.. gives me an error.. saying: Type 'Dogs' does not conform to protocol 'Identifiable'. Why this is happening?
@logankoshenka
@logankoshenka 2 года назад
It usually says that when you don’t have an ID variable
@denglishiu
@denglishiu Год назад
At 20:53 *let dog = Dog(......)* I'm having some troubles with my code. The error message pops up "Expected expression after operator," with the "l" underlined for 'let.' My code is a little different. Just replace "dog" with "workout." let workout = Workout(........) Does anyone have any idea how to fix the error?
@logankoshenka
@logankoshenka Год назад
sorry for the late response, did you solve your issue?
@timur9848
@timur9848 Год назад
Hey! On 27:07 I get an error on line 19 "Cannot find 'dataManager' in scope". Could you please help me fix this, thanks!
@logankoshenka
@logankoshenka Год назад
my apologies, I didn't see your comment - I hope you were able to solve your issue!
@Dionphaneufistoogood
@Dionphaneufistoogood 2 года назад
Hi Logan - at @9:39 when you don't add the initialization code, is there anything else we have to add (other than the FirebaseApp.configure()). I thought I might have missed something because I have a 'App Delegate does not conform to UIApplicationDelegate protocol' error message in the output. Apologies if I missed it in the video.
@logankoshenka
@logankoshenka 2 года назад
sorry for the late response - did you figure it out?
@johnpill1
@johnpill1 2 года назад
Did you name your project just Firebase. I did and I think that causes the error as you need to refer to it and the compiler then isn't sure, do you mean the app or the framework. Renaming the whole project and app struct resolved this error.
@nikkic1094
@nikkic1094 2 года назад
I’m having the same issue :/
@mikasackermann1383
@mikasackermann1383 Год назад
I have the same error too and nothing comes on my firebase authentication user page.
@MaxFritzhand
@MaxFritzhand 2 года назад
How would you get the data to automatically reload without having to close out of the app?
@logankoshenka
@logankoshenka 2 года назад
what do you mean?
@MaxFritzhand
@MaxFritzhand 2 года назад
@@logankoshenka you mentioned near the end of the video that you close out of the app and then dog data you wrote is now there. My question is more so, how would you go about avoiding to close out of the app and have it the dog data persist from adding it to Firestore to being pulled again since you added a new doc on the main screen. As the init() calls the fetchDogs on launch
@logankoshenka
@logankoshenka 2 года назад
ahhh gotcha - definitely check out the async / await video I posted (my most recent)! You can use that format to call fetchDogs ... another approach is to use the pull to refresh ... in swiftui it is very straightforward! for that method, check this tutorial out: www.swiftbysundell.com/articles/making-swiftui-views-refreshable/
@mitko746
@mitko746 Год назад
Hey, I made the Sign Up and Log In separate, but whenever I Sign Up and go to Log in, I need to navigationLink to the Sign In Screen View, which already puts me in the main menu, since the if sees that userLoggedIn = true, any ideas for that? I tried to change the bool with a State change on the Sign Up view, but that doesn't work
@logankoshenka
@logankoshenka Год назад
you could do something like : NavigationLink(destination: loggedIn ? oneView : anotherView) … does that make sense?
@mitko746
@mitko746 Год назад
@@logankoshenka Hey, thank you for the quick answer, I just implemented Auth.auth().signOut function provided by Firebase and it all worked out! :D But I'm going to look into your idea as well.
@logankoshenka
@logankoshenka Год назад
great!!!
@Lindellmattiaslindell
@Lindellmattiaslindell 2 года назад
Could you please explain what to write where it says "//go somewhere" since i am struggling to make it go to a new page if login is successfull
@logankoshenka
@logankoshenka 2 года назад
of course! Notice how it's an if / else statement ... so according to the state variable, we show either "content" or something else ... perhaps my comment in the code should have said "// show something else" ... basically, you could show another view by creating a var: body similar to how we set up "content" OR the better way would probably be to create another view in another file ... say we create a swiftui view called "HomeView" ... we add what we want to add, then we can replace "// go somewhere" with "HomeView()" so that it updates the view as soon as the user logs in ... make sense?
@Lindellmattiaslindell
@Lindellmattiaslindell 2 года назад
@@logankoshenka got it working! Really appreciate the response, you got a new sub
@logankoshenka
@logankoshenka 2 года назад
great to hear :D
@DavidNitzscheBell
@DavidNitzscheBell 2 года назад
20:33 if you had added `Codable` to your `struct Dog` earlier, you wouldn't need to decode each property one-by-one.
@logankoshenka
@logankoshenka 2 года назад
true - I wanted to show it this way for the sake of the tutorial
@homeoffice3524
@homeoffice3524 Год назад
Why this is possible with super expensive database like this but not possible with mysql?
@logankoshenka
@logankoshenka Год назад
what do you mean?
@homeoffice3524
@homeoffice3524 Год назад
@@logankoshenka I can't find any beginner friendly tutorial how to do it with MYSQL what is free.
@logankoshenka
@logankoshenka Год назад
ahhh man I’m sorry to hear that!
@raquelframe
@raquelframe Год назад
is it possible to get the final code?
@logankoshenka
@logankoshenka Год назад
Hi Raquel, the source code can be found here: logankoshenka.gumroad.com/l/swiftuifirebase
@EarlyFinances
@EarlyFinances Год назад
Is this secure enough for a real app?
@logankoshenka
@logankoshenka Год назад
yes! the main thing to check is the security rules on firebase … when testing, the database is a bit vulnerable, but you can set it up so that you only allow read / write permissions to authenticated users … but yes, lots of apps out there are using firebase!
@EarlyFinances
@EarlyFinances Год назад
@@logankoshenka thanks for the quick response what would you recommend for self hosting a database
@THEMMB
@THEMMB 2 года назад
how would they signout?
@logankoshenka
@logankoshenka 2 года назад
I def should have included that! Here is the code snippet ... would just have to connect this to a sign out button: do { try Auth.auth().signOut() } catch let signOutError as NSError { print("Error signing out: %@", signOutError) }
@THEMMB
@THEMMB 2 года назад
Awesome! Worked like a charm!
@logankoshenka
@logankoshenka 2 года назад
😁 great!
@quincysorrentino6415
@quincysorrentino6415 2 года назад
@@logankoshenka could you by chance give a more detailed explanation of how to do this because I cant seem to get it to work (im very new to programming)
@raquelframe
@raquelframe Год назад
I get a fatal error for DataManager
@logankoshenka
@logankoshenka Год назад
where?
@Gjmouen
@Gjmouen Год назад
How could I add a UUID() to create a unique id code for each dog? I tried adding it into the (dog swift file) dog struct variable id, although wasnt able to change it from String to Int... Any suggestions?
@logankoshenka
@logankoshenka Год назад
UUID is like its own unique type … you can use UUID() or UUID().uuidString and you should def be able to use it for the dog’s id variable 💪
@Gjmouen
@Gjmouen Год назад
@@logankoshenka thanks for the quick response! I’ll just have to tinker with the code a bit to get it working. Another quick question, I tried changing the content view variable userIsLoggedIn Boolean to true so that it toggles to false (just to test to see if I can get the login screen) and no matter what I do I can’t get the login/signup view to show…
@Gjmouen
@Gjmouen Год назад
I even deleted the user on the fire base authentication page and can’t figure out how to get the create user page to work correctly
@logankoshenka
@logankoshenka Год назад
try deleting the app on the device or simulator to reset it!
@johnpill1
@johnpill1 2 года назад
Great tutorial covering so much! It would be great to see a part 2 doing more with the DB side of the Firebase DB. I've jsut started exploring this so hoping to work out how to store and fetch images and delete etc. I've already made it a little more interesting for anyone else following along by adding the following code on to the List modifiers to add the pull to refresh feature! Next work out how to delete: .refreshable { await dataManager.fetchGuitars() }
@johnpill1
@johnpill1 2 года назад
A log out function would also be great to go full circle. I've deleted the account in the Firebase db but the programme still logs into the ListView even when changing the initial App view to be the ContentView. I think this is because there isn't a way to check that the user still exists in the db? Not sure.
@logankoshenka
@logankoshenka 2 года назад
Thanks! Will do!
@dawmthedev
@dawmthedev Год назад
Bro you sound exactly like sean O'maley lol
@logankoshenka
@logankoshenka Год назад
😂😂😂😂 first time I heard that
@ferremaes9838
@ferremaes9838 Год назад
source code pls
@logankoshenka
@logankoshenka Год назад
You can download the project here: logankoshenka.gumroad.com/l/swiftuifirebase
@courtneyjackson4895
@courtneyjackson4895 Год назад
I was just about to start dancing because I had not had any difficulties until the last moment...... I'm 13.36 mins into the video. The Build is Successful; however, I am not able to enter email address or password. Instead I get this message: Thread 1: "The default FirebaseApp instance must be configured before the default Authinstance can be initialized. One way to ensure this is to call `FirebaseApp.configure()` in the App Delegate's `application(_:didFinishLaunchingWithOptions:)` (or the `@main` struct's initializer in SwiftUI)." I am new so don't understand what to do with that. Any kind soul willing to help a newbie? I might have missed it. Thank you in advance.
@logankoshenka
@logankoshenka Год назад
haha yes it's the part at roughly 10:20! it's just saying that firebase wasn't setup in your app yet! and that FirebaseApp.configure() takes care of that for you!
@danielhearbik2119
@danielhearbik2119 Год назад
This design is cap like try to set it up on other devices it will completely fail. People here don't know anything about swiftui
@logankoshenka
@logankoshenka Год назад
thanks for watching!
Далее
SwiftUI API / JSON Tutorial with Async Await Example
9:52
iPhone 16 для НИЩЕБРОДОВ!
00:51
Просмотров 2,1 млн
SwiftUI List with Custom Cell & Passing Data
36:27
Просмотров 116 тыс.
Cursor Is Beating VS Code (...by forking it)
18:00
Просмотров 94 тыс.