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 UA-cam 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
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 😊
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
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.
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!
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 :)
@@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 :)
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.
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)
@@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.
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
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".
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!!
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 👍
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?
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!!!
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
@@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
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)
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.
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?
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!
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?
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?
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!
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.
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?
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 :)
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 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.
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?
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 👍🏼
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?
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 :)
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
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?
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 :)
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?
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?
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!
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.
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.
@@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
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/
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 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…
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.
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!
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) }
@@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)
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() }
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.
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
}
}
}
Some time small creator are more helpful than big creator thanks for the knowledge I really appreciate.
thanks so much!
My god it works…. Your voice is strong enough to carry this without background music
noted 💪
Great brother, such an important topic and you made it look so easy !!.
This tutorial is very on point and straightforward. Thank you so much for this!
glad you enjoyed it!
i was subscribe another channels who are making videos about swiftui but after this video i delete them all !!
Nice job.
haha glad to have you here!!
Hey Logan, fantastic tutorial. Also helps that my daughter and you share a great name!
Hope to see more from you!
No way! Happy to help!
Just add .environmentObject(DataManager()) to your ListView() inside of your preview code!!
Great tutorial, just what I was looking for! Thank you!
great!
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
love that!! thanks for watching & commenting!!
These videos are literally the most helpful thing i've come across, thank you for everything Logan
love hearing that, thanks for watching!
@@logankoshenka Can't wait for the next video!
tomorrow!
Can you make a mini series on this, we would all love it!
good idea! what else would you like to see?
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 UA-cam 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
awesome thank you!
Thanks for the clear explanation! Firebase looks like a handy thing when you don't want to set up the backend
Glad you liked it - and yeah, I rely on Firebase heavily!
@@logankoshenka 👍
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 😊
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 🍻
great to hear! thanks! 🤝
Nice Video Logan, very easy to follow
thank you!
Amazing stuff, great job man!
thanks for watching 🤝
Very useful tutorial - and it worked! Just wish there wasn't any background music - bit distracting. But found the tutorial very helpful. Thank you.
Noted - thank you!!
keep it up, This is really great! keep the good work going
thank you 🙏
really appreciate your video man! great job taking the time and effort on this. awesome content
thanks, glad you like it!
Amazing.. someday this channel would be big
thank you! I’m trying 🤞
Thanks for making these videos, Orlando, I've learned a lot.
Totally weird that Legolas is doing SwiftUI videos, though ...
😂😂😂
King! Thanks so much for this awesome tutorial, helped me so much :D
glad you liked it!
@@logankoshenka One question, what goes in the else statement in the var body: some View { in ContentView?
my code has:
var body: some View {
if userIsLoggedIn {
ListView()
} else {
content
}
}
(with "content" containing everything inside of the ZStack)
@@logankoshenka Awesome, tysm!
You made it so easy!
Hey! Really appreciate the video. How are you highlighting view frames in your preview?
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
omg, You are really a genius!!!!Thank you sooooooo much
😁
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.
you should be able to read all about Firebase Firestore here! firebase.google.com/docs/firestore
Great content and easy to understand
🙏🏼
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!
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 :)
@@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 :)
we need part 2, more deeper one, with auto generated id (UUID)
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.
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)
Love to see your channel growing ! 😊
Don’t forget me when your channel hits 100k landmark !
means the world - thank you!!!
Nice video, How do you represent custom object array in firebase cloud database?
Good tutorial… thank you
thanks!
@@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.
you’re right - good catch!
What’s your take on encapsulating your firebase logic in a service class? then instantiating in your view
a common approach! just a matter of a personal preference :)
Nice....great video
thank you!
do u have a video for when user clicking on forget password in welcome screen ?? 😂
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
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".
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!!
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 👍
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?
haha just do a bunch of them! It just takes time!
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!!!
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
@@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
@@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?
I guess that's from the $State portion of it retaining the information afterwards. Thanks for the video!
Great job thanks for the tutorial
thank you!
great vid, is their a way to fetch the users location and home address?
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)
Great tutorial. Can you please share a link to the code / github?
yes I will!
@@logankoshenka when?
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.
This tutorial handles this incorrectly. Try refactoring the state toggle to the login function.
Hey Logan, great video, wondering if I could have a hand on turning the List(environmentobject.variable) to a ForEach loop, thanks :)
sorry for the late reply - List and a Stack / ForEach combo are pretty interchangeable! what are you trying to do?
is it ok to help me in my graduation project ? we made it with Swift storyboard , is everything works on it ?
I see everybody using hardcoded values for frames and offsets etc, won’t that have unpredictable results on different devices and resolutions?
yeah I think it all depends on what you’re doing, but the minWidth / maxWidth can help with that
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?
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!
Does this work by using storyboard instead?
yep! firebase code should be the same!
Yeeeah
Just what we need
😁
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?
sorry for the late response, did you solve your issue?
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 ?
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
@@logankoshenka i tried that aswell sadly and it just expend the area but not the tappable area
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?
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!
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.
hmm, did you get this worked out? sorry for the late response!
@@logankoshenka i follow the steps on firebase and add init code to main page.
cant understand what is the problem exactly then i restart everything just like what firebase says
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?
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 :)
About the Dog file.. gives me an error.. saying: Type 'Dogs' does not conform to protocol 'Identifiable'. Why this is happening?
It usually says that when you don’t have an ID variable
Instead of Rectangle for underline, can just use Divider()
You’re 100% right haha for some reason I was worried about the spacing … sometimes I’ll use Rectangle instead for more customization.
Hey! On 27:07 I get an error on line 19 "Cannot find 'dataManager' in scope". Could you please help me fix this, thanks!
my apologies, I didn't see your comment - I hope you were able to solve your issue!
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
you could do something like : NavigationLink(destination: loggedIn ? oneView : anotherView) … does that make sense?
@@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.
great!!!
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?
yes! that part is covered in the video!
@@logankoshenka Cool! Do you have any tips on how to log out?
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 👍🏼
@@logankoshenka appreciate the help and the quick replies mate! Keep up the good work. Gained a sub 💪🏾
of course, thank you!
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?
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 :)
Does realm have a built-in authentication like Firebase. Also since i learnt mongodb, is Realm better than firebase?
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
22:15 is it necessary to add `id: \.id` since you declared `struct Dog: Identifiable`? It shouldn't be needed.
Yes - you’re right about this one. It’s not needed. Thanks for catching that!
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?
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 :)
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?
totally necessary … if you don’t remove all, you’d get duplicates when you fetch! gotta clear previous use :)
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
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?
@@logankoshenka got it working! Really appreciate the response, you got a new sub
great to hear :D
is it possible to get the final code?
Hi Raquel, the source code can be found here: logankoshenka.gumroad.com/l/swiftuifirebase
Why this is possible with super expensive database like this but not possible with mysql?
what do you mean?
@@logankoshenka I can't find any beginner friendly tutorial how to do it with MYSQL what is free.
ahhh man I’m sorry to hear that!
Is this secure enough for a real app?
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!
@@logankoshenka thanks for the quick response what would you recommend for self hosting a database
3Q so much!
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.
sorry for the late response - did you figure it out?
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.
I’m having the same issue :/
I have the same error too and nothing comes on my firebase authentication user page.
How would you get the data to automatically reload without having to close out of the app?
what do you mean?
@@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
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/
I get a fatal error for DataManager
where?
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?
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 💪
@@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…
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
try deleting the app on the device or simulator to reset it!
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.
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!
20:33 if you had added `Codable` to your `struct Dog` earlier, you wouldn't need to decode each property one-by-one.
true - I wanted to show it this way for the sake of the tutorial
Bro you sound exactly like sean O'maley lol
😂😂😂😂 first time I heard that
how would they signout?
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)
}
Awesome! Worked like a charm!
😁 great!
@@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)
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()
}
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.
Thanks! Will do!
source code pls
You can download the project here: logankoshenka.gumroad.com/l/swiftuifirebase
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
thanks for watching!