iOS 13 SwiftUI Tutorial: Interactively Transition and Share Data between Views with SwiftUI

  Рет қаралды 40,510

Brian Advent

Brian Advent

Күн бұрын

In this tutorial you are going to learn how to use State, ObservableObject and EnvironmentObject to share data between views and also how to transition between views using navigation link and sheet (modal transitions).
➡️ Project Files Start/Finish: / xcode-project-29511026
➡️ Tutorial on Property Wrappers: • iOS 13 Swift Tutorial:...
➡️ Tutorial on Combine: • iOS 13 Swift Tutorial:...
🛒 GAME DEVELOPMENT COURSE - JUST $20 🛒
www.udemy.com/...
👏 Support me on Patreon: / brianadvent
➡️ Web: www.brianadvent...
✉️ COMMENTS ✉️
If you have questions about the video or Cocoa programming, please comment below.

Пікірлер: 54
@santhoshVnair
@santhoshVnair 4 жыл бұрын
Very nice, short & sweet, right to the point - no fluff. Thanks.
@eamiller
@eamiller 4 жыл бұрын
This is AMAZING. Thank you so much for this. These data variables have been so confusing in every tutorial until now. So cool. Thanks for doing this man!!
@אנורסיאח
@אנורסיאח 3 жыл бұрын
Thanks man, this video has been very helpful for me with my project that I'm working on. You are very well informed!
@ESquirez
@ESquirez 3 жыл бұрын
Fantastic brain The way you explained this was spot on 👏🏿👏🏿👏🏿
@seccat
@seccat 4 жыл бұрын
Thanks for keeping the subject up to date. thanks for covering for the ObservableObject (because of the deprecated BindableObject).
@frankfernandez1957
@frankfernandez1957 4 жыл бұрын
What an amazing explanation! Thank you so much, i have been having problems understanding this!!!
@kelvinjou4582
@kelvinjou4582 4 жыл бұрын
This is the most straight to the point and relevant video for me! Thanks a million, ur content is awesome
@mohitchaturvedi6088
@mohitchaturvedi6088 4 жыл бұрын
Superb tutorial Brian, as always detailed video, described data transfer between views nicely. I always look forward to your videos and tutorials...Thanks!!
@andrevdw747
@andrevdw747 4 жыл бұрын
Great tutorial Brian! One of the few that explained also the WHY :-)
@_armtic
@_armtic 5 жыл бұрын
watching this from Japan!
@namelastname4077
@namelastname4077 5 жыл бұрын
Fine. Now go kill some whales...
@hampussepe9487
@hampussepe9487 4 жыл бұрын
this is by far the best video and explanation I've found so far on this subject! thanks for really digging in to it and keeping your examples on the topic and not just bake it in with 100 different things, a 1000 thanks and keep up the good work!
@sebonnefoy
@sebonnefoy 4 жыл бұрын
Thanks a lot, the most instructive video I've watched 😊
@AlexCio
@AlexCio 5 жыл бұрын
the animation looks smooth!
@sergiobost4891
@sergiobost4891 4 жыл бұрын
Just what I needed! Thanks!
@BalaaLyf
@BalaaLyf 4 жыл бұрын
Please upload one more video for this pass data.. Multiple labels and multiple textfields.. Data transfer and save it
@xiaoyuhu4264
@xiaoyuhu4264 5 жыл бұрын
Hi Brian, thank you for this amazing video! I love how your videos are always so comprehensive and straight forward. I would really love to see more content on Multi-peer connectivity framework(MCF) from you. Like a tutorial on how to use MCF to maybe transfer data, or even eventually interaction between different devices. I think if you make it into a series, it would be really cool!
@kyoheo5326
@kyoheo5326 4 жыл бұрын
You are so cool! thank you very much please more videos like this !!!
@jersey-dude
@jersey-dude 5 жыл бұрын
really quality content and very well explained. subbed on patreon. Thx for the content
@rahuljamba5846
@rahuljamba5846 3 жыл бұрын
Excellent !!!
@GreenDevBabe
@GreenDevBabe 5 жыл бұрын
Hi Brian. Please make small video about new BackgroundTasks. Because old doesn't work well anymore in Xcode 11.
@bolivarbryan
@bolivarbryan 5 жыл бұрын
Greetings from Colombia Brian. Thanks for sharing this content, Great work done here :-)
@mukulbakshi28
@mukulbakshi28 5 жыл бұрын
Great Content man, love it , very knowledgable.
@markaurelius61
@markaurelius61 5 жыл бұрын
Very informative. It was not explained though how the environment variables declared in the views picked up the right value. They just seemed to be declared. Can you explain that?
@rebeloper
@rebeloper 5 жыл бұрын
That is just the nature of @EnvironmentObject It's like a "singleton", but not really, there's more to it.
@ضدالظلم-د4ح
@ضدالظلم-د4ح 5 жыл бұрын
You are amazing 😉 It’s so Fantastic 😳👍 Thank you so much ☺️
@danielbelemduarte
@danielbelemduarte 4 жыл бұрын
@Brian, how to you handle and EnvironmentObject that needs to be updated after a JSON response. I'm setting the following error: "Publishing changes from background threads is not allowed; make sure to publish values from the main thread (via operators like receive(on:)) on model updates."
@pickemparty
@pickemparty 4 жыл бұрын
Can you do a tutorial that mirrors the wallet app where if you select the apple card or apple cash , the screen goes to full screen and doesnt do either of the two transitions you are showing in this tutorial?
@titoffen
@titoffen 4 жыл бұрын
Great tutorial, thank you! However, how would you inject an object in Environment that conforms to a protocol? In other words, say we want to use a real network manager in production and a mock object for testing/development (which would retrieve the payload from a file in the app's bundle). Both classes would conform to a given protocol, but the trouble would appear when you declare the @EnvironmentObject. Which type should be specified? We cannot specify either class, because it could be either one. If we specify the protocol, we get a "Property type 'MyProtocol' does not match that of the 'wrappedValue' property of its wrapper type 'EnvironmentObject'". Any ideas?
@briefinsight8758
@briefinsight8758 4 жыл бұрын
perfect! i liked it
@crazy9videos
@crazy9videos 4 жыл бұрын
Great! suppose that the SecondView has another struct as ThirdView in the same class and how can we dismiss the sheet from ThirdView?
@thomascaster1911
@thomascaster1911 4 жыл бұрын
I have two pickers and I would like to make a selection of these pickers and change the view with a click of a button.
@rickywitherspoon2861
@rickywitherspoon2861 5 жыл бұрын
At 8:50 you show that userData is passed from A to B. Can it then be passed from B to C or do you have to use an EnvirnomentObject? In this example the environment object would be better, but let’s say you have a view controllers A-H and only a A,B, and C need userData data. I’m having a hard time passing an observable object to more than one other view controller like you showed.
@sam2223
@sam2223 5 жыл бұрын
Hello Brian I have a question and hope that you can help me. I have created a "single view" and made the first page. with a button I linked to the second page. if I activate the "assistant editor" on the second page it shows me "UIResponder.h" and not this one I have selected in "class". I hope for an answer. thanks
@danielwatson6529
@danielwatson6529 4 жыл бұрын
Yo Yo Yo, this helped me lots, however when i took the concept to my own project, everything worked, howver when i switched screens the bindable value vanished into thin air. how do i save this, and/or more specifically persist the new value to core date when the screen disapears.
@danielwatson6529
@danielwatson6529 4 жыл бұрын
In reponse to the recent like to this comment. I i fixed it in this way, however it is not the way. what I did was create a function to persist to core data, and ran that function as my navigation switched views. That is all i needed for my project, however a more precise way, i think would be to have the instance of the observable object being called when an instance of your entity is created. This is easyish to do, however i am stuggling a bit because my structure is being defined in core data and i have no idea, or have found any tutorials that can help me figure out how to do this - please let me know if you guys find a solution
@danielwatson6529
@danielwatson6529 4 жыл бұрын
Ok, so i fixed the issue. NSManagedObject conforms to ObservableObject. so i have an @Published property in there, which i assign as an empty string when i have a new entity created, then i linke textfields to it. feel free to pm me if you need further help
@nurlankalybekov7336
@nurlankalybekov7336 3 жыл бұрын
It would be much more interactive if you keep typing during video, instead of Copy/Paste-ing us ready code
@SHIVAMGUPTA-pb7ru
@SHIVAMGUPTA-pb7ru 4 жыл бұрын
very clearly expalin
@demaupeoucorentin
@demaupeoucorentin 5 жыл бұрын
Hey! In your last tutorial with Core Data (ToDoList app), I've a problem with the environment in SceneDelegate file. When you set the environment of the menu of the app, you add the code with Core Data. And for me, Xcode say some errors... Have an idea for don't have this? Code : let managedObjectContext = (UIApplication.shared.delegate as! AppDelegate).persistentContainer.viewContext let contentView = ContentView().environment(ERROR HERE, managedObjectContext) window.rootViewController = UIHostingController(rootView: ContentView())
@danielwatson6529
@danielwatson6529 4 жыл бұрын
try just "let context = (UIApplication.......... im guessing you error might be a invalid redeclaration error?
@danielwatson6529
@danielwatson6529 4 жыл бұрын
let context = (UIApplication.shared.delegate as! AppDelegate).persistentContainer.viewContext let contentView = ContentView().environment(\.managedObjectContext, context)
@nickng8069
@nickng8069 5 жыл бұрын
SecondView seems to be asking for variable initializing down in the preview_ ???
@danielwatson6529
@danielwatson6529 4 жыл бұрын
I just delete those bits and run the simulator, lazy i know but i dont really get it, you fix it?
@matthewperrault6390
@matthewperrault6390 4 жыл бұрын
I HATE SWIFTUI. IT is STRAIGHT GARBAGE. 3 days now just to update an integer, then pass it over to another VC and print it. I couldn't understand/follow what you were saying, 1/2 of your project was already done, VERY frustrating. I know I build the same thing with storyboards in 5 minutes.
@matthewross611
@matthewross611 5 жыл бұрын
How does this interact with core data?
@rebeloper
@rebeloper 5 жыл бұрын
Check out his other video about SwiftUI with Core Data: kzbin.info/www/bejne/Y3O9lYSjfbtng7M
@MrVipulLal
@MrVipulLal 3 жыл бұрын
Such a long video to explain a simple concept ,!!!!!
@edvardharnes4220
@edvardharnes4220 3 жыл бұрын
Bad didaktik, zu viele themen vorher geshrieben....zb model
@pijushdebbarma7979
@pijushdebbarma7979 4 жыл бұрын
It’s too long video and clumsy for beginners to get your idea in mind.
@אנורסיאח
@אנורסיאח 3 жыл бұрын
Thanks man, this video has been very helpful for me with my project that I'm working on. You are very well informed!
Neil deGrasse Tyson Explains the Physics of Formula One Racing
16:47
Sigma baby, you've conquered soap! 😲😮‍💨 LeoNata family #shorts
00:37
Миллионер | 1 - серия
34:31
Million Show
Рет қаралды 3 МЛН
didn't manage to catch the ball #tiktok
00:19
Анастасия Тарасова
Рет қаралды 33 МЛН
5 Steps to Better SwiftUI Views
31:19
Paul Hudson
Рет қаралды 56 М.
8 Common SwiftUI Mistakes - and how to fix them!
28:05
Paul Hudson
Рет қаралды 50 М.
NSURLProtocol: How I Stole an App For My Wedding
56:25
Bryce Bostwick
Рет қаралды 49 М.
Simple Code, High Performance
2:50:14
Molly Rocket
Рет қаралды 255 М.
The Complete Guide to NavigationView in SwiftUI
39:18
Paul Hudson
Рет қаралды 130 М.
SwiftUI 2.0: MVVM - A Practical Approach
14:28
BeyondOnesAndZeros
Рет қаралды 32 М.
How to use gestures in SwiftUI - Flashzilla SwiftUI Tutorial 1/13
16:13