iOS 13 Swift Tutorial: Understand Swift UI, Property Wrapper & More (@State & @EnvironmentObject)

แชร์
ฝัง
  • เผยแพร่เมื่อ 8 ต.ค. 2024
  • Get a better understanding of how Swift UI works, what lies behind @State and @EnvironmentObject and how you work with data in and across different views. Bonus: See how to display an Alert View
    🛒 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.

ความคิดเห็น • 40

  • @jorgesegundorojas6119
    @jorgesegundorojas6119 4 ปีที่แล้ว +1

    Dude, this tutorial it's a treasure !

  • @glebcherkashyn2357
    @glebcherkashyn2357 5 ปีที่แล้ว +3

    so, now in iOS we have "native Rx" and "native flutter". Nice tutorial, thank you! =)

  • @daLuftie
    @daLuftie 4 ปีที่แล้ว +9

    Just for information:
    BindableObject is changed to ObservableObject.
    ObjectBinding is now ObservedObject.

    • @dougbelli9866
      @dougbelli9866 4 ปีที่แล้ว

      Also in UserDefault.swift I had to change var value to var wrappedValue. Great Tut, thanks!

  • @mattmmilli8287
    @mattmmilli8287 5 ปีที่แล้ว

    Mind blown around 22:00 🤯🤯
    thank you for great example

  • @JunaidKhan-ny8tu
    @JunaidKhan-ny8tu 5 ปีที่แล้ว +1

    nice and clean Explanantion

  • @dimiutube
    @dimiutube 4 ปีที่แล้ว

    Wow! That was a lot of information! Thanks for the great tutorial!!

  • @KhairilUshan
    @KhairilUshan 5 ปีที่แล้ว

    Great. Thank you, Brian. Can you also please make videos to explain another Swift feature that backed the SwiftUI implementation? Like for example: Function builder, Opaque return type

  • @thomasengland1701
    @thomasengland1701 5 ปีที่แล้ว +1

    This is great Brian. Can you share how you can use the environment object in multiple views. On a presentation view I’m not getting access to the environment object.

    • @w0mblemania
      @w0mblemania 5 ปีที่แล้ว

      That's strange. If you set the environment object at the start of a view hierarchy, all descendants are supposed to have access to that object. Possible a bug?

  • @w0mblemania
    @w0mblemania 5 ปีที่แล้ว

    Good video, thanks Brian.

  • @krutomjer
    @krutomjer 5 ปีที่แล้ว

    Niiiice, these tutorials are great. They are binding (wink, wink) all of the frameworks together, the SwiftUI, combine etc

  • @amit1922003
    @amit1922003 5 ปีที่แล้ว

    Another amazing tutorial. Thank you so much🙏

  • @patrickclaessens9418
    @patrickclaessens9418 5 ปีที่แล้ว

    Thanks Brian

  • @АлексейПархоменко-х9ы
    @АлексейПархоменко-х9ы 5 ปีที่แล้ว +1

    I have got this problem: Property wrapper type 'UserDefault' does not contain a non-static property named 'wrappedValue'. I have got the latest version of Xcode 11 beta 7. Could you please say we how to fix it?

    • @daniellehill5196
      @daniellehill5196 5 ปีที่แล้ว +3

      I had this error too. Just replace 'var value' with 'var wrappedValue' :)

  • @xxThemoritzxx
    @xxThemoritzxx 5 ปีที่แล้ว

    Nice Tutorial, if i will Build a todo app, should i Store the Information inside the userdefaults or is the use of Core Data better?

    • @BrianAdvent
      @BrianAdvent  5 ปีที่แล้ว

      The more complex your data structure and data model get the more you should think about using core data. Once you need relationships I would definitely use core data. If you just want to store some to do items User Defaults could do the job.

    • @w0mblemania
      @w0mblemania 5 ปีที่แล้ว

      Also consider just saving your data to a json file, using Codable. It's a LOT easier than using CoreData for simple-to-medium sized data sets. Use CoreData as a last resort, IMO.

  • @RomanMedvid
    @RomanMedvid 5 ปีที่แล้ว

    Wow, thanks man

  • @danielwatson6529
    @danielwatson6529 4 ปีที่แล้ว

    has anyone got a link for the swift evolution proposal? i had a look but im not really sure what is it is that i am looking fior

  • @touchdani
    @touchdani 5 ปีที่แล้ว

    Greaet Tutorial ;)!

  • @arinasawa2638
    @arinasawa2638 5 ปีที่แล้ว

    How would you use frameworks like AV Foundation with Swift UI Only? I know this framework is new and you might not know, and it is annoying for people to ask you these kind of questions when this framework literally just came out, but I just hope this makes you explore swift UI more!

    • @w0mblemania
      @w0mblemania 5 ปีที่แล้ว

      As to the specifics of AV Foundation, I don't know, but any UIView subclass can be used in SwiftUI (at least in theory) by using UIViewControllerRepresentable. This is a wrapper around your non-SwiftUI views, that SwiftUI can handle.

    • @arinasawa2638
      @arinasawa2638 5 ปีที่แล้ว

      @@w0mblemania Yeah I get that, but I really want to know If it is possible just using SwiftUI and nothing else,

    • @w0mblemania
      @w0mblemania 5 ปีที่แล้ว

      @@arinasawa2638 In that case, no. SwiftUI is extremely bare-bones (and extremely rough) at this point. Even the most common things aren't supported.

  • @subscriber6181
    @subscriber6181 5 ปีที่แล้ว

    Nice!

  • @myevit
    @myevit 5 ปีที่แล้ว

    @propertyWrapper
    struct UserDefault {
    let key: String
    let defaultValue:T
    var value:T {
    get{
    return UserDefaults.standard.object(forKey: key) as? T ?? defaultValue
    }
    set{
    UserDefaults.standard.set(newValue, forKey: key)
    }
    }
    }
    gives error: Property wrapper type 'UserDefault' does not contain a non-static property named 'wrappedValue'

  • @kerk09b
    @kerk09b 5 ปีที่แล้ว

    How to count the number of rows after filtered by favorite?

    • @BrianAdvent
      @BrianAdvent  5 ปีที่แล้ว +1

      I would not count the rows but the elements in the array that are faved. You can do that with the result of the swift filter function.

  • @asigivati1382
    @asigivati1382 5 ปีที่แล้ว

    ⭐️

  • @lukassbeataddicts
    @lukassbeataddicts 5 ปีที่แล้ว

    Who else think they making Swift more difficult with every update. Swift 3 was comfortable for me but this getting harder and harder.

    • @BrianAdvent
      @BrianAdvent  5 ปีที่แล้ว

      That’s an interest opinion. I can definitely understand if you are confused about the declarative style of SwiftUI but what changed between Swift 3 and 5 that you feel uncomfortable with?

    • @lukassbeataddicts
      @lukassbeataddicts 5 ปีที่แล้ว

      @@BrianAdventMore closures and protocols, swift was meant to be easy to read and expressive. Actually I've watched some Apple videos and starting to like SwiftUI. Dragging from menu and Xcode automatically writes code is pretty cool.

  • @mukulbakshi28
    @mukulbakshi28 5 ปีที่แล้ว

    Love from india 1

    • @vishrutvatsa
      @vishrutvatsa 5 ปีที่แล้ว +2

      MUKUL BAKSHI Can you please stop commenting shit just because you want your comments to get a few likes?

    • @mukulbakshi28
      @mukulbakshi28 5 ปีที่แล้ว

      Vishrut Vatsa so why u have problem. I dont ask u to judge. Grow up. I dont need ur approval to comment.

  • @DavidNitzscheBell
    @DavidNitzscheBell 5 ปีที่แล้ว

    nope. That didn't make any sense.

    • @w0mblemania
      @w0mblemania 5 ปีที่แล้ว

      You'll also need to watch the WWDC videos. They are required viewing at this point.