How to display a gif in SwiftUI? 💡

Поделиться
HTML-код
  • Опубликовано: 1 фев 2025
  • НаукаНаука

Комментарии • 51

  • @ameyajoshi5673
    @ameyajoshi5673 Год назад

    Very simple and concise. Great tutorial. Just a hint, you could also declare the url as let url:URL!, so you won't need to use Force unwrapping later on in the code.

  • @sureshkutagulla4526
    @sureshkutagulla4526 3 года назад +1

    Nice Pitt Bro , I am Beginner understanding quickly and clear

    • @swiftandtips
      @swiftandtips  3 года назад

      Keep going!! 👏😄. I’m glad these videos are helping you @Suresh

  • @DaveJacobseniOS
    @DaveJacobseniOS 2 года назад

    Exactly what I needed! Thanks Pitt

    • @swiftandtips
      @swiftandtips  2 года назад

      You’re welcome Dave ☺️!

    • @yygysgtyfugunvt
      @yygysgtyfugunvt 2 года назад

      @Dave jacobsen in my case only white screen coming
      can you please help me?

  • @jackadams911
    @jackadams911 Год назад +1

    thanks alot u really saved me i subbed💯

  • @ilies4tech
    @ilies4tech 2 года назад

    Thanks man we appreciate your content, that was very helpful ❤️

  • @jctech14
    @jctech14 Год назад

    Great and useful video. Native development offers as easy and straightforward solutions as third party frameworks and APIs do. Thanks.

  • @RobertHolzapfel
    @RobertHolzapfel 3 года назад

    Very good video material, nice teaching style, essential content. Thanks a lot for sharing your knowledge! 👍🏻

  • @Alexander-mg4pr
    @Alexander-mg4pr 2 года назад

    Awesome, creative method! Thank you!

  • @illyakrit7494
    @illyakrit7494 Год назад

    Nice tutorial! Thank you!

    • @swiftandtips
      @swiftandtips  11 месяцев назад +1

      Glad it was helpful! ☺️

  • @rungxanh2901
    @rungxanh2901 2 года назад

    This is exactly what I need. Thank you so much boss 🤝

  • @bihter3201
    @bihter3201 6 месяцев назад

    Great stuff

  • @pavankumar.m1341
    @pavankumar.m1341 3 года назад

    Nice idea i didn't know if that's simple

  • @cmlra
    @cmlra 3 года назад

    Excellent video, it works smoothly. Please guide how to disable the repeat for gif Image.

    • @swiftandtips
      @swiftandtips  3 года назад

      Thanks Qazi! Do you mean just reproduce it once?

    • @cmlra
      @cmlra 3 года назад +1

      @@swiftandtips yes exactly , it should repeat the animation once and then stop.

    • @swiftandtips
      @swiftandtips  3 года назад

      I see, let me investigate and I’ll reply you back 👌

    • @cmlra
      @cmlra 3 года назад

      @@swiftandtips thanks for your time and response

  • @mario-zz7ft
    @mario-zz7ft 3 года назад

    thank you nice video it help a lot

    • @swiftandtips
      @swiftandtips  3 года назад +1

      Your welcome Mario! I’m glad it was useful for you😀!

  • @Mbra771
    @Mbra771 2 года назад

    Thanks for the video. Is it possible to change the output? I would like to change the gif after some time!?

    • @swiftandtips
      @swiftandtips  2 года назад

      Hi Mbra771, I haven't tried yet, but I don't see any issue to do it.

  • @TomoShinozaki-un8sv
    @TomoShinozaki-un8sv 6 месяцев назад

    Hi, my GIF seems to only loop once. Do you know how to fix this by any chance?

    • @swiftandtips
      @swiftandtips  6 месяцев назад

      Not sure why, but I can investigate 👍

  • @Joseopal
    @Joseopal 3 года назад

    thank you for inspiring video! I learn a lot from your video! One more question I wanna ask is about the background of gif. For the example of pocketmon ball in your video, I wanna remove the blue background and only want to display the red ball itself. I tried your code and I got my gif with white background automatically. How can I display gif without adding white background?? My original gif has no background! Thanks!

    • @Joseopal
      @Joseopal 3 года назад

      I fixed it! made the opaque function true!

    • @swiftandtips
      @swiftandtips  3 года назад

      Great 😃! How is the code?

    • @swiftandtips
      @swiftandtips  2 года назад

      What I recommend you is to actually remove the background from the gif itself instead of adding extra work in the code just for removing it 👍

    • @swiftandtips
      @swiftandtips  2 года назад

      If you could send me a tweet with a screenshot would be great 👍

    • @louislaw299
      @louislaw299 2 года назад +2

      same issue, if you try dark mode you'd see the white background issue, I set website.isOpaque=false to workaround this

  • @oguzyuksel5815
    @oguzyuksel5815 3 года назад

    It works well if you have static view but I can't use this something like @State var selectedGif: String. I mean it doesn't update gif.

    • @swiftandtips
      @swiftandtips  3 года назад

      Interesting 🤔, what is your approach @Oguz?

    • @oguzyuksel5815
      @oguzyuksel5815 3 года назад +1

      @@swiftandtips Just put two gif file in bundle such as 1.gif, 2.gif then call GifImage in ContentView with a state property inside, switch between "1.gif" and "2.gif" by a Button. GifImage will render always initial state.

    • @swiftandtips
      @swiftandtips  3 года назад

      I see, I will try that later today. Thanks!

  • @yygysgtyfugunvt
    @yygysgtyfugunvt 2 года назад

    in my case only white screen coming
    can you please help me?

    • @swiftandtips
      @swiftandtips  2 года назад

      Hi Adarsh, share a gist link to me and I could take a look.

    • @melihbasturk627
      @melihbasturk627 Год назад

      @@swiftandtips Same. white screen and this message in :
      Error acquiring assertion:

  • @iIiI-sw3ht
    @iIiI-sw3ht Год назад

    Hi , Thanks for this great work , I did it and work with me but all image have background "White" I want clear backGround this gif )=

    • @swiftandtips
      @swiftandtips  Год назад

      Thanks for your comment. Yeah, that’s something I noticed too. I will try to find a solution for it soon.

    • @ireneadler6075
      @ireneadler6075 Год назад

      did you find it?@@swiftandtips