Skip to content

mroffmix/SwipebleView-Example

Repository files navigation

Swipeable View

Logo
Check package repo »

Report Bug · Request Feature

Description

Simple "editActionsForRowAt" functionality, written on SWIFTUI Can be applied without list to every view.

Swipeable View

Code sample

Independent view

var leftActions = [
        Action(title: "Note", iconName: "pencil", bgColor: .note, action: {}),
        Action(title: "Edit doc", iconName: "doc.text", bgColor: .edit, action: {}),
        Action(title: "New doc", iconName: "doc.text.fill", bgColor: .done, action: {}),
    ]
    
SwipeableView(content: {
                        Text("Swipe to see actions")
                            .frame(maxWidth: .infinity, maxHeight: .infinity)
                            .background(Color.gray)
                        
                    },
                    leftActions: Example.leftActions,
                    rightActions: Example.rightActions,
                    rounded: false) // there are two styles 
                    .frame(height: 90)

Create object of SwManager

var container = SwManager()

Create arrays with actions:

var leftActions = [
        Action(title: "Note", iconName: "pencil", bgColor: .note, action: {}),
        Action(title: "Edit doc", iconName: "doc.text", bgColor: .edit, action: {}),
        Action(title: "New doc", iconName: "doc.text.fill", bgColor: .done, action: {}),
    ]
    
static var rightActions = [
        Action(title: "Delete", iconName: "trash", bgColor: .delete, action: {})
    ]

SwipeableView usage:

SwipeableView(content: {
  // Your view content here 
  },
  leftActions: Example.leftActions,
  rightActions: Example.rightActions,
  rounded: false)
  .frame(height: 90)

Contributing

Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.

  1. Fork the Project
  2. Create your Feature Branch
  3. Commit your Changes
  4. Push to the Branch
  5. Open a Pull Request

License

Distributed under the MIT License. See LICENSE for more information.

Contact

Ilya Mikhailov - @mix_off - [email protected]

Project Link: https://github.com/mroffmix/SwipebleView

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages