Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/mroffmix/Swipeable-View

Simple editActionsForRowAt functionality, written on SWIFTUI
https://github.com/mroffmix/Swipeable-View

swift5 swiftui swiftui-components swipe swipeable

Last synced: about 2 months ago
JSON representation

Simple editActionsForRowAt functionality, written on SWIFTUI

Awesome Lists containing this project

README

        


Swipeable View




Logo



Check usage example »



Report Bug
·
Request Feature

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

![Swipeable View](https://github.com/mroffmix/SwipebleView/blob/main/Resources/WholeScreen.gif)

## Installation

It requires iOS 14 and Xcode 12!

In Xcode got to `File -> Swift Packages -> Add Package Dependency` and paste inthe repo's url: `https://github.com/mroffmix/SwipebleView`

### Import:

import the package in the file you would like to use it: `import SwipebleView`

### Demo

Added an example project, with **iOS** target: https://github.com/mroffmix/SwipebleViewExample

### Usage

### Create array of actions

```swift
let left = [
Action(title: "Note", iconName: "pencil", bgColor: .red, action: {}),
Action(title: "Edit doc", iconName: "doc.text", bgColor: .yellow, action: {}),
Action(title: "New doc", iconName: "doc.text.fill", bgColor: .green, action: {})
]

let right = [
Action(title: "Note", iconName: "pencil", bgColor: .blue, action: {}),
Action(title: "Edit doc", iconName: "doc.text", bgColor: .yellow, action: {})
]
```
### Create SwipeableView
```swift
SwipeableView(content: {
GroupBox {
Text("View content")
.frame(maxWidth: .infinity, maxHeight: .infinity)
}
},
leftActions: left,
rightActions: right,
rounded: true
).frame(height: 90)
```

![Swipeable View](https://github.com/mroffmix/SwipebleView/blob/main/Resources/IndependedView.gif)

### SwipeableView in container
If you want to use your views in a container, as Table view, you have to ctreate
```swift
var container = SwManager()
```
And put your SwipeableViews to this container
```swift
SwipeableView(content: {

// your view here

},
leftActions: Example.leftActions,
rightActions: Example.rightActions,
rounded: true,
container: container)
.frame(height: 100)
```
Views behaviour in a container

![Swipeable View](https://github.com/mroffmix/SwipebleView/blob/main/Resources/ViewsInAContainer.gif)

### Roadmap

See the [open issues](https://github.com/mroffmix/Swipeable-View/issues) for a list of proposed features (and known issues).

## 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](https://twitter.com/mix_off) - [email protected]

Project Link: [https://github.com/mroffmix/SwipebleView](https://github.com/mroffmix/SwipebleView)