Skip to content

About

Apple Intelligence Glow Effects

Resources

Stars

324 stars

Watchers

6 watching

Forks

Repository files navigation

Apple Intelligence Glow Effect

A beautiful, customizable SwiftUI-based glow effect that mimics Apple's Intelligence UI design language. This effect is built entirely in SwiftUI without Metal shaders, making it lightweight and easy to implement across Apple platforms.

Header

Features

  • 🌟 Pure SwiftUI implementation - no Metal shaders required
  • πŸ“± Cross-platform support for Apple devices
  • 🎨 Fully customizable colors and animations
  • ⚑️ Optimized performance with configurable parameters
  • πŸ”„ Smooth, fluid animations
  • 🎯 Easy to integrate into existing projects
  • πŸ”‹ Low power mode variant for older devices and battery saving
  • πŸš€ Fixed timer leaks and reduced CPU usage from 100% to 20-60%

Platform Support

  • βœ… WatchOS (Complete)
  • βœ… iOS (Complete)
  • βœ… iPadOS (Complete)
  • ⏳ macOS (Coming Soon)

Demos

WatchOS

Two performance-optimized versions available:

  • WatchOS.swift: Standard optimized version (Series 10, Ultra 1/2 compatible)
  • WatchOS_WithFreeze.swift: Enhanced version with freeze capability and full WatchOS 11 compatibility (all watch sizes)

Both versions now feature:

  • Fixed timer leaks that caused 100% CPU usage
  • Optimized rendering with reduced CPU usage (30-50%)
  • Better battery life

WatchOS Demo

iOS

Two stunning effects with performance-optimized variants:

  1. Type to Siri Effect (TypeToSiri.Swift)

    • Optimized with proper timer cleanup
    • Minimal CPU usage (5-10%)
    • Suitable for all iOS devices
  2. Apple Intelligence Glow Effect

    • IOS.swift: Standard version (optimized for iPhone 12+, 40-60% CPU)
    • IOS_LowPowerMode.swift: Ultra-performance version for older devices or battery saving (20-30% CPU)

IOS Type To Siri Effect IOS Demo

iPadOS

Optimized for iPad's larger display with adjusted parameters:

  • Increased corner radius (65pt) for better visual proportion on larger screens
  • Enhanced glow effect with adjusted blur radii and line widths
  • Smooth animations perfectly tuned for iPad displays Performance Note: All files have been optimized to fix critical timer leaks that caused 100% CPU usage. See PERFORMANCE_GUIDE.md for complete optimization details and device recommendations.

Installation

  1. Copy the desired platform file (e.g., WatchOS.swift, IOS.swift, or iPadOS.swift) into your project
  2. Import the file in your SwiftUI view
  3. Implement the effect as shown in the examples below

Customization Guide

1. Animation Timing

Adjust the animation speed and interval to match your needs:

Timer.scheduledTimer(withTimeInterval: 0.25, repeats: true) { _ in
    withAnimation(.easeInOut(duration: 0.5)) {
        gradientStops = GlowEffect.generateGradientStops()
    }
}

2. Color Customization

Modify the gradient colors to match your app's theme:

static func generateGradientStops() -> [Gradient.Stop] {
    [
        Gradient.Stop(color: Color(hex: "BC82F3"), location: Double.random(in: 0...1)),
        Gradient.Stop(color: Color(hex: "F5B9EA"), location: Double.random(in: 0...1)),
        Gradient.Stop(color: Color(hex: "8D9FFF"), location: Double.random(in: 0...1)),
        Gradient.Stop(color: Color(hex: "AA6EEE"), location: Double.random(in: 0...1)),
        Gradient.Stop(color: Color(hex: "FF6778"), location: Double.random(in: 0...1)),
        Gradient.Stop(color: Color(hex: "FFBA71"), location: Double.random(in: 0...1)),
        Gradient.Stop(color: Color(hex: "C686FF"), location: Double.random(in: 0...1))
    ].sorted { $0.location < $1.location }
}

3. Layer Customization

Fine-tune the effect's appearance by adjusting layer properties:

ZStack {
    // Base layer with no blur
    EffectNoBlur(gradientStops: gradientStops, width: 5)
        .onAppear {
            Timer.scheduledTimer(withTimeInterval: 0.25, repeats: true) { _ in
                withAnimation(.easeInOut(duration: 0.5)) {
                    gradientStops = GlowEffect.generateGradientStops()
                }
            }
        }
    
    // Blurred overlay layer
    Effect(gradientStops: gradientStops, width: 7, blur: 4)
        .onAppear {
            Timer.scheduledTimer(withTimeInterval: 0.3, repeats: true) { _ in
                withAnimation(.easeInOut(duration: 0.6)) {
                    gradientStops = GlowEffect.generateGradientStops()
                }
            }
        }
}

Usage Examples

Basic Implementation

struct ContentView: View {
    @State private var gradientStops: [Gradient.Stop] = []
    
    var body: some View {
        ZStack {
            // Your content here
            GlowEffect(gradientStops: gradientStops)
                .onAppear {
                    gradientStops = GlowEffect.generateGradientStops()
                }
        }
    }
}

With Custom Parameters

struct CustomGlowView: View {
    @State private var gradientStops: [Gradient.Stop] = []
    
    var body: some View {
        ZStack {
            EffectNoBlur(gradientStops: gradientStops, width: 3)
            Effect(gradientStops: gradientStops, width: 5, blur: 3)
        }
        .onAppear {
            gradientStops = GlowEffect.generateGradientStops()
        }
    }
}

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This project is open source and available under the MIT License.


⭐️ If this project helped you, please consider giving it a star!

About

Apple Intelligence Glow Effects

Resources

Stars

324 stars

Watchers

6 watching

Forks

Releases

Packages

Contributors

Languages