swiftui-buymeacoffee

1.0.0

A Swift package for creating branded Buy Me a Coffee links in SwiftUI.
alexandrehsaad/swiftui-buymeacoffee

What's New

1.0.0

2026-09-13T17:30:25Z

SwiftUI Buy Me a Coffee

A Swift package for creating branded Buy Me a Coffee links in SwiftUI.

Overview

BuyMeACoffee provides a branded SwiftUI button that opens a creator's Buy Me a Coffee page. It includes solid and Liquid Glass button styles, selectable tints, and an automatic contrasting border for light and dark interfaces.

The button works with standard SwiftUI label styles and button border shapes, supports Dynamic Type and accessibility settings, and displays the official Buy Me a Coffee logo alongside its matching icon.

Requirements

  • Swift 6.3+
  • iOS 15+

BuyMeACoffee is written in Swift and is available on iOS platforms.

Installation

  1. Add BuyMeACoffee to the dependencies in your Package.swift file:

    let package: Package = .init(
        ...
        dependencies: [
            .package(
                url: "https://github.com/alexandrehsaad/swiftui-buymeacoffee.git",
                from: "1.0.0"
            )
        ],
        ...
    )
  2. Add the BuyMeACoffee product to the dependencies of the target that will import it. Replace YourTarget with the name of that target:

    let package: Package = .init(
        ...
        targets: [
            .target(
                name: "YourTarget",
                dependencies: [
                    .product(
                        name: "BuyMeACoffee",
                        package: "swiftui-buymeacoffee"
                    )
                ]
            )
        ],
        ...
    )
  3. Import the package in your source code:

    import BuyMeACoffee

Demonstration

BuyMeACoffeeButton(username: "myusername")
    .labelStyle(.titleAndIcon)
    .buttonStyle(.buyMeACoffeeGlass(tint: .yellow))

The glass style requires iOS 26 or later. Use .buyMeACoffee(tint: .yellow) on earlier versions.

The code above renders the button below. Click it to visit my Buy Me a Coffee page.

Buy me a coffee

Documentation

You can read more about this package by visiting the documentation.

License

Distributed under the MIT License. See the third-party notices for materials covered by separate terms.

This is an independent, unofficial project and is not affiliated with, sponsored by, or endorsed by Buy Me a Coffee. The Buy Me a Coffee name, logo, and related artwork belong to Buy Me a Coffee and are not licensed under this project's MIT License.

This repository is a personal educational portfolio project created to explore various technologies. It is distributed without charge and is not intended to suggest a commercial relationship with Buy Me a Coffee.

Description

  • Swift Tools 6.3.0
View More Packages from this Author

Dependencies

Last updated: Sun Nov 29 2026 17:17:18 GMT-1000 (Hawaii-Aleutian Standard Time)