Contents

balochcodes/pulseglowbutton

An eye-catching, high-conversion call-to-action button for SwiftUI featuring an animated radiant breathing glow aura, expanding concentric sonar ripple rings, tactile press physics, and seamless async loading state transitions.

✨ Features

  • 🌟 Radiant Ambient Glow: Organic breathing light aura radiating softly around the button container with configurable blur radiuses and bloom colors.
  • πŸ“‘ Concentric Sonar Ripples: Pulsating wave rings expanding outwards with progressive opacity fade.
  • πŸ“³ Tactile Press Physics: Smooth spring compression scaling on finger touch coupled with native iOS haptic feedback (UIImpactFeedbackGenerator).
  • ⏳ Integrated Loading Spinner: Instant switch between normal CTA content and a progress indicator with state preservation (isLoading: true).
  • 🎨 Gradient & Solid Styles: Supports multi-stop linear gradients, solid fills, custom corner radii, and padding via PulseGlowStyle.
  • ⚑ Zero External Dependencies: 100% native SwiftUI with zero third-party bloat.

πŸ“¦ Installation

In Xcode (Recommended)

  1. Open your project in Xcode and navigate to File βž” Add Package Dependencies...
  2. In the search field, paste the repository URL:

``text https://github.com/BalochCodes/PulseGlowButton.git ``

  1. Select Up to Next Major Version (1.0.0) and click Add Package.

In Package.swift

Add PulseGlowButton to your dependencies:

dependencies: [
    .package(url: "https://github.com/BalochCodes/PulseGlowButton.git", from: "1.0.0")
]

Import the package in your SwiftUI files:

import SwiftUI
import PulseGlowButton

πŸš€ Usage Examples

1. High-Conversion "Claim Reward" Hero CTA

PulseGlowButton(
    title: "Claim Daily Reward",
    systemImage: "star.fill",
    style: PulseGlowStyle(
        glowColor: Color(red: 0.54, green: 0.36, blue: 0.96),
        maxGlowRadius: 24,
        backgroundColor: Color(red: 0.49, green: 0.23, blue: 0.93),
        cornerRadius: 20
    ),
    action: {
        print("Reward claimed!")
    }
)

2. Live Broadcast / Emergency Beacon with Gradient

PulseGlowButton(
    title: "GO LIVE NOW",
    systemImage: "dot.radiowaves.left.and.right",
    style: PulseGlowStyle(
        glowColor: Color.red,
        rippleColor: Color(red: 1.0, green: 0.4, blue: 0.4),
        rippleCount: 3,
        rippleMaxScale: 1.5,
        gradient: LinearGradient(
            colors: [Color.red, Color(red: 0.8, green: 0.1, blue: 0.1)],
            startPoint: .topLeading,
            endPoint: .bottomTrailing
        ),
        cornerRadius: 24,
        pulseDuration: 1.4
    ),
    action: {
        print("Live streaming initiated!")
    }
)

3. Asynchronous Checkout Button with Loading Spinner

struct CheckoutButtonView: View {
    @State private var isProcessing = false

    var body: some View {
        PulseGlowButton(
            title: "Complete Checkout ($49.00)",
            systemImage: "lock.fill",
            style: PulseGlowStyle(
                glowColor: Color.green,
                backgroundColor: Color(red: 0.05, green: 0.65, blue: 0.4),
                cornerRadius: 16
            ),
            isLoading: isProcessing,
            action: {
                isProcessing = true
                DispatchQueue.main.asyncAfter(deadline: .now() + 2) {
                    isProcessing = false
                }
            }
        )
    }
}

πŸ› οΈ API Reference

PulseGlowButton

| Parameter | Type | Default | Description | | :--- | :--- | :--- | :--- | | title | String | β€” | Text label displayed on the button. | | systemImage | String? | nil | SF Symbol icon name placed before the title. | | style | PulseGlowStyle | PulseGlowStyle() | Custom visual appearance and animation parameters. | | enableGlow | Bool | true | Toggles breathing ambient radiant glow aura on/off. | | enableRipples | Bool | true | Toggles expanding concentric sonar ripple rings on/off. | | enableHaptics | Bool | true | Triggers tactile feedback on press (iOS only). | | isLoading | Bool | false | When true, renders circular progress indicator and disables taps. | | action | () -> Void | Required | Action closure fired when the button is tapped. |

PulseGlowStyle

| Parameter | Type | Default | Description | | :--- | :--- | :--- | :--- | | glowColor | Color | Color(0xFF6366F1) | Aura light color radiating around the button container. | | maxGlowRadius | CGFloat | 20.0 | Maximum blur radius at peak of breathing glow cycle. | | minGlowRadius | CGFloat | 6.0 | Minimum blur radius at bottom of breathing glow cycle. | | rippleColor | Color? | nil | Color of sonar ripples (defaults to glowColor). | | rippleCount | Int | 2 | Number of concentric expanding sonar rings. | | rippleMaxScale | CGFloat | 1.35 | Outer boundary expansion factor for ripples. | | gradient | LinearGradient?| nil | Multi-stop gradient fill for button surface. | | backgroundColor | Color | Color(0xFF6366F1) | Solid background fill if no gradient is set. | | cornerRadius | CGFloat | 16.0 | Corner radius of the button and its glow mask. | | horizontalPadding| CGFloat | 24.0 | Internal horizontal padding around content. | | verticalPadding | CGFloat | 14.0 | Internal vertical padding around content. | | pulseDuration | Double | 1.8 | Duration in seconds of one breathing/ripple cycle. |


πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

Author

Created by Shahzain Baloch.

Package Metadata

Repository: balochcodes/pulseglowbutton

Default branch: main

README: README.md