Skip to content

Releases: aheze/SwipeActions

SwipeViewGroup and syntax improvements

14 Apr 02:01
Compare
Choose a tag to compare

Introducing SwipeViewGroup

  • Simply wrap your views in SwipeViewGroup to allow only one open at a time.
SwipeViewGroup {
    SwipeView {} /// Only one of the actions will be shown.
    SwipeView {}
    SwipeView {}
}
SwipeViewGroup.mov

Syntax improvements for swipe-to-trigger

  • SwipeActions can now infer swipeToTriggerLeadingEdge and swipeToTriggerTrailingEdge automatically.
  • swipeActionEdgeStyling() has been renamed to allowSwipeToTrigger().

Before

SwipeView {
    Text("Swipe")
} leadingActions: { _ in
    SwipeAction("Leading") {}
        .swipeActionEdgeStyling()
} trailingActions: { _ in
    SwipeAction("Trailing") {}
        .swipeActionEdgeStyling()
}
.swipeToTriggerLeadingEdge(true)
.swipeToTriggerTrailingEdge(true)

After

SwipeView {
    Text("Swipe")
} leadingActions: { _ in
    SwipeAction("Leading") {}
        .allowSwipeToTrigger()
} trailingActions: { _ in
    SwipeAction("Trailing") {}
        .allowSwipeToTrigger()
}

Syntax improvements for SwipeView

If you only want trailingActions and don't want leadingActions, or the other way around, you can now omit it completely!

  SwipeView {
      Text("Hello")
          .frame(maxWidth: .infinity)
          .padding(.vertical, 32)
          .background(Color.blue.opacity(0.1))
          .cornerRadius(32)
- } leadingActions: { _ in
  } trailingActions: { _ in
      SwipeAction("World") {
          print("Tapped!")
      }
  }

Initial Release

13 Apr 07:37
Compare
Choose a tag to compare

Introducing SwipeActions, a swift package to add swipe actions to any view! Yes, not just Lists — all view work.

SwiftUI already has support for swipe actions on Lists, but that's it. They're also not customizable at all — you can't change the corner radius, or anything (see here and here). SwipeActions fixes all these problems, and adds more features!

  • Enable swipe actions on any view, not just Lists.
  • Customize literally everything — corner radius, color, etc...
  • Supports drag-to-delete and advanced gesture handling.
  • Fine-tune animations and styling to your taste.
  • Programmatically show/hide swipe actions.
  • Made with 100% SwiftUI. Supports iOS 14+.
  • Lightweight, no dependencies. One file.
SwipeActions.mp4