Тёмный

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

Brian Advent
Подписаться 75 тыс.
Просмотров 40 тыс.
50% 1

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.

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

 

5 окт 2024

Поделиться:

Ссылка:

Скачать:

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

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 54   
@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!!
@seccat
@seccat 4 года назад
Thanks for keeping the subject up to date. thanks for covering for the ObservableObject (because of the deprecated BindableObject).
@santhoshVnair
@santhoshVnair 4 года назад
Very nice, short & sweet, right to the point - no fluff. Thanks.
@kelvinjou4582
@kelvinjou4582 4 года назад
This is the most straight to the point and relevant video for me! Thanks a million, ur content is awesome
@ESquirez
@ESquirez 3 года назад
Fantastic brain The way you explained this was spot on 👏🏿👏🏿👏🏿
@אנורסיאח
@אנורסיאח 3 года назад
Thanks man, this video has been very helpful for me with my project that I'm working on. You are very well informed!
@frankfernandez1957
@frankfernandez1957 4 года назад
What an amazing explanation! Thank you so much, i have been having problems understanding this!!!
@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 :-)
@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!
@AlexCio
@AlexCio 5 лет назад
the animation looks smooth!
@sebonnefoy
@sebonnefoy 4 года назад
Thanks a lot, the most instructive video I've watched 😊
@BalaaLyf
@BalaaLyf 4 года назад
Please upload one more video for this pass data.. Multiple labels and multiple textfields.. Data transfer and save it
@_armtic
@_armtic 5 лет назад
watching this from Japan!
@namelastname4077
@namelastname4077 5 лет назад
Fine. Now go kill some whales...
@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!
@jersey-dude
@jersey-dude 5 лет назад
really quality content and very well explained. subbed on patreon. Thx for the content
@sergiobost4891
@sergiobost4891 3 года назад
Just what I needed! Thanks!
@rahuljamba5846
@rahuljamba5846 2 года назад
Excellent !!!
@GreenDevBabe
@GreenDevBabe 5 лет назад
Hi Brian. Please make small video about new BackgroundTasks. Because old doesn't work well anymore in Xcode 11.
@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.
@bolivarbryan
@bolivarbryan 5 лет назад
Greetings from Colombia Brian. Thanks for sharing this content, Great work done here :-)
@kyoheo5326
@kyoheo5326 4 года назад
You are so cool! thank you very much please more videos like this !!!
@mukulbakshi28
@mukulbakshi28 5 лет назад
Great Content man, love it , very knowledgable.
@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.
@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?
@ضدالظلم-د4ح
@ضدالظلم-د4ح 4 года назад
You are amazing 😉 It’s so Fantastic 😳👍 Thank you so much ☺️
@briefinsight8758
@briefinsight8758 4 года назад
perfect! i liked it
@nurlankalybekov7336
@nurlankalybekov7336 3 года назад
It would be much more interactive if you keep typing during video, instead of Copy/Paste-ing us ready code
@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?
@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
@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?
@SHIVAMGUPTA-pb7ru
@SHIVAMGUPTA-pb7ru 4 года назад
very clearly expalin
@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?
@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."
@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
@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: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE--BZdQmHV4MQ.html
@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)
@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.
@YoureHot
@YoureHot 2 года назад
I'm struggling. I'm trying to transfer an integer from one view to another, but I've spent days trying to find out with no luck. My end goal is to make is so that the player can see the score in the "gameOver" view. Anyone who knows how?
@אנורסיאח
@אנורסיאח 3 года назад
Thanks man, this video has been very helpful for me with my project that I'm working on. You are very well informed!
Далее
8 Common SwiftUI Mistakes - and how to fix them!
28:05
Редакция. News: 137-я неделя
42:24
Просмотров 621 тыс.
НЕ БУДИТЕ КОТЯТ#cat
00:21
Просмотров 1,1 млн
8. SwiftData   CloudKit
18:20
Просмотров 7 тыс.
Modern Python logging
21:32
Просмотров 190 тыс.
SwiftUI 2.0: MVVM - A Practical Approach
14:28
Просмотров 32 тыс.
dotSwift 2020 - Erica Sadun - Property Wrappers
17:57
Просмотров 4,7 тыс.
Редакция. News: 137-я неделя
42:24
Просмотров 621 тыс.