SwiftUI - Swipe Actions on List | iOS 15 & Xcode 13

Поділитися
Вставка
  • Опубліковано 22 сер 2024

КОМЕНТАРІ • 31

  • @kdtechniquesofficial6153
    @kdtechniquesofficial6153 3 роки тому +4

    NavigationView{
    List{
    ForEach(VideoListArray){ video in
    NavigationLink( destination: VideoDetailView(video: video) ,label: {
    VideoCell(video: video)
    })
    .swipeActions(edge: .trailing, allowsFullSwipe: false) {
    Button(role: .destructive){
    print("Delete")
    }label:{
    Image(systemName: "trash.circle.fill")
    }
    }
    }
    }
    Hello Sean bro. I think your swipe actions didn't work with the navigation links you created right. Because you need to set swipe actions not to the video cell you created but for the navigation link. For each loop is also needed. Thanks for making this video. I learned these function from you video. Then i realised how to solve swipe action problem on the navigation link.

    • @seanallen
      @seanallen  3 роки тому +1

      Nice! Thanks for sharing. I'll have to test that out. I appreciate it!

  • @Alejandro_Away
    @Alejandro_Away 3 роки тому +1

    What worked for me was having .swipeActions modifier be for the NavigationLink inside a ForEach which is inside a List view

  • @Eugene.Berezin
    @Eugene.Berezin 3 роки тому

    Yup! I’ve noticed that too. Removing a separator for a row is also not working if it’s not in ForEach!

  • @cristopherescorcia3276
    @cristopherescorcia3276 3 роки тому

    Man love your videos, you are the reason i am learning Swift

  • @KimbrellBrad
    @KimbrellBrad 3 роки тому

    Great notes on the current hurdles to making these swipe actions work. Thanks Sean!

  • @vamsi3877
    @vamsi3877 3 роки тому

    SwiftUI becoming more handy

  • @JeffCournoyerATC
    @JeffCournoyerATC 3 роки тому +2

    Hey Sean, great video! Do you think they’re going to fix the functionality with the swipeActions not being available inside a NavigatoinView? The mail app on iOS does this so it might work. Otherwise how would you suggest making these cells interactive to pull up another view?

  • @DaveJacobseniOS
    @DaveJacobseniOS 3 роки тому

    Good stuff! Thanks for the run through.

  • @gregohb
    @gregohb 3 роки тому +1

    Is there a download link for the code?

  • @jalexromero
    @jalexromero 2 роки тому

    wow awesome video! I wish I had watched this Monday, as I spent last two days figuring out lists. I have a question, hope you see it and are able to comment... when you add a navigation link to the list, it adds a ">" symbol on the right hand side of every list element... is there a way to eliminate this? Just curious, as I don't like how it looks, is redundant, and steals real estate for your content... Anyway hope you have any suggestions here to eliminate this navigation symbol. I've tried a few things but so far not working and need to move on to next part of my project... Thanks & keep up the great videos!

  • @tonyd6853
    @tonyd6853 3 роки тому +1

    Haven't these been around for a long time?

    • @seanallen
      @seanallen  3 роки тому

      On the iOS platform, yes. However, SwiftUI received a new modifier in iOS 15 that handles this easily.

  • @shaxzodziyadullayev9115
    @shaxzodziyadullayev9115 10 місяців тому

    How to programmatically show swipe action buttons on image tap in that row?

  • @dominikgrodl7822
    @dominikgrodl7822 3 роки тому +2

    Hi Sean. Great video as always! Just wanted to follow on the fact that the full swipe wasn't available on your simulator- it works in my code, the system grabs the button which is closest to the respective edge (which is even the default behaviour throughout the system, f.e. in the Mail app). I don't know what makes it not work in your code or what makes it work in mine though, just wanted to clarify that.

    • @seanallen
      @seanallen  3 роки тому +1

      Thanks for pointing this out. Good to know!

  • @FlashGamer521
    @FlashGamer521 Рік тому

    I don't see any List Tutorial code in the Description...

  • @FabricioMTL
    @FabricioMTL 2 роки тому

    Hey Sean how to do this when you have a NavigationLink

  • @gofudgeyourselves9024
    @gofudgeyourselves9024 3 роки тому

    baby face is back

  • @ghantasalavarichannel857
    @ghantasalavarichannel857 2 роки тому

    Hi Sean,
    There is a problem to show both icon and text on Swipe Actions in SwiftUI for macOS 12. It is not working for me. Can you please provide me some idea.

  • @Pobe16
    @Pobe16 3 роки тому

    Can I set one of the buttons to be main one when doing a full swipe?

  • @VladimirWeinsteinPhotography
    @VladimirWeinsteinPhotography 3 роки тому

    This was great, thanks! Trying to implement a swipeAction to favorite (in this case alternating a bool in my modeldata) in the ForEach but getting an error, since the ForEach is a read-only copy of the array. What would be the best solution for something like that?

  • @VitVids
    @VitVids 3 роки тому

    Is there a way to have those actions without background (and make custom buttons)?
    E.g. you use List without separators and each row has view with rounded corners and paddings (look at the navigation center). Default swipe actions won’t look good here.

  • @nileshjdarji
    @nileshjdarji 3 роки тому

    A quick side question. Do SwiftUI have UserDefaults equivalent?

    • @nileshjdarji
      @nileshjdarji 3 роки тому

      @Omeir Ahmed Khan Thank you Omeir.

  • @KenjiEmura
    @KenjiEmura 2 роки тому

    How can I also show the swipeActions options when the cell is tapped?

    • @shaxzodziyadullayev9115
      @shaxzodziyadullayev9115 10 місяців тому

      hello, did you find solution to your question?

    • @KenjiEmura
      @KenjiEmura 10 місяців тому

      @@shaxzodziyadullayev9115Hi, unfortunately I don’t remember what I ended up doing

  • @user-hm5dx7yi3s
    @user-hm5dx7yi3s 3 роки тому

    Can use swipeAction in Xcode12?

  • @VasaMusic438
    @VasaMusic438 3 роки тому

    with all these curly braces is will be very easy to get lost