Skip to content

SwiftUI library that contains cool button styles such as 'duolingo', similar to used in Duolingo app.

Notifications You must be signed in to change notification settings

alpaycli/ButtonStyles

Repository files navigation

ButtonStyles

ButtonStyles is a simple, reusable Swift package for creating custom button styles using SwiftUI. Currently, it includes the DuolingoButtonStyle, a 3D button style similar to used in Duolingo app.

Features

  • Setting background color.
  • Supports ButtonRole parameter.
  • Disabled state.

Installation

Requirements

  • iOS 15.0+

Via Swift Package Manager

Usage

Basic Usage

import ButtonStyles
import SwiftUI

Button("Tap Me") {}
    .buttonStyle(.duolingo(color: .green))
    .foregroundStyle(.white)
    .padding()

Different states

import ButtonStyles
import SwiftUI

VStack(spacing: 20) {
    Button("Tap Me") {}
        .buttonStyle(.duolingo(color: .green))
    
    Button("Tap Me", role: .destructive) {}
        .buttonStyle(.duolingo(color: .green))
    
    Button("Tap Me", role: .destructive) {}
        .buttonStyle(.duolingo(color: .green))
        .disabled(true)
    
}
.padding()
.foregroundStyle(.white)

License

ButtonStyles is available under the MIT license. See the LICENSE file for more info.

Contributions

Contributions are welcome! If you have any suggestions or improvements, please create an issue or submit a pull request.

About

SwiftUI library that contains cool button styles such as 'duolingo', similar to used in Duolingo app.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages