Swiftpack.co - rushairer/SwipeButton as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by rushairer.
rushairer/SwipeButton 1.0.0
SwipeButton for SwiftUI
⭐️ 3
🕓 2 years ago
iOS macOS watchOS
.package(url: "https://github.com/rushairer/SwipeButton.git", from: "1.0.0")

SwipeButton

GitHub code size in bytes GitHub GitHub release (latest by date including pre-releases) GitHub tag (latest by date)

A swipe button for SwiftUI if you do not using <List>.

Declaration

SwipeButtonModifier(leftButtonLabel: (() -> SwipeActionContent)? = nil,
                    leftButtonColor: Color = .green,
                    leftButtonAction: (() -> Void)? = nil,
                    rightButtonLabel: (() -> SwipeActionContent)? = nil,
                    rightButtonColor: Color = .red,
                    rightButtonAction: (() -> Void)? = nil,
                    style: SwipeButtonStyle = .wave)
            
public enum SwipeButtonStyle {
    case wave
    case rectangle
}

Usage

struct SwipeButtonView_Previews: PreviewProvider {
    static var previews: some View {
        Text("Swipe Button")
            .foregroundColor(.white)
            .frame(maxWidth: .infinity, maxHeight: .infinity)
            .background(Color.pink)
            .modifier(SwipeButtonModifier(leftButtonLabel: {
                Image(systemName: "heart")
                    .font(.system(size: 16, weight: .bold))
                    .foregroundColor(.white)
                    .opacity(1)
            },
            leftButtonAction: {
                
            },
            rightButtonLabel: {
                Image(systemName: "xmark")
                    .font(.system(size: 16, weight: .bold))
                    .foregroundColor(.white)
                    .opacity(1)
            },
            rightButtonAction: {
                
            },
            style: .rectangle))
            .frame(height: 150)
            .preferredColorScheme(.dark)
        
    }
}

Screenshot

History

History

LICENSE

The MIT License (MIT)

GitHub

link
Stars: 3
Last commit: 2 years ago
Advertisement: IndiePitcher.com - Cold Email Software for Startups

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics