Skip to content

Lets SwiftUI elements glow brighter than the screen using HDR, taking advantage of extended brightness on compatible displays.

License

Notifications You must be signed in to change notification settings

Aeastr/GlowGetter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
GlowGetter Icon

GlowGetter

Add customizable glow effects to your SwiftUI views.

Swift 6.0+ iOS 15+ License: MIT Experimental

Example 1 Example 2

Overview

GlowGetter provides two implementations for adding glow effects:

Target API App Store Safe Method
GlowGetter Public Yes Metal-rendered overlay
GlowGetterPrivate Private No CAFilter EDR (true HDR brightness)

Installation

dependencies: [
    .package(url: "https://github.com/Aeastr/GlowGetter.git", from: "2.0.0")
]

Add the target you need:

.target(
    name: "YourTarget",
    dependencies: [
        .product(name: "GlowGetter", package: "GlowGetter"),
        // OR
        .product(name: "GlowGetterPrivate", package: "GlowGetter")
    ]
)

Usage

GlowGetter (Public API)

Metal-powered overlay effect. Safe for App Store.

import GlowGetter

// Basic glow
Color.orange
    .glow(0.8)

// With shape clipping
Color.orange
    .clipShape(Circle())
    .glow(0.8, Circle())

GlowGetterPrivate (Private API)

Warning

Uses private CAFilter APIs. May be rejected by App Store review, may break in future iOS updates. We are not responsible for any consequences of using this in your applications. Use at your own risk.

True HDR brightness using the edrGainMultiply filter. Only visible on HDR-capable displays.

import GlowGetterPrivate

// EDR glow (values typically 2.0-10.0)
Color.orange
    .glowEDR(4.0)

To preview: Use My Mac | Mac Catalyst if your Mac supports HDR—simulators won't show the effect.

How It Works

GlowGetter (Public)

Uses a Metal layer to render a glow overlay blended with the underlying view. The overlay is applied via GlowRenderView wrapped in the .glow() modifier.

GlowGetterPrivate (Private)

Wraps the view in a UIViewRepresentable and applies CAFilter's edrGainMultiply to the layer. Private API strings are obfuscated at compile-time using Obfuscate.

Acknowledgments

GlowGetter (Public): Thanks to Jordi Bruin and Ben Harraway for their insights on the Metal rendering. Adapts code built for Vivid.

GlowGetterPrivate: Thanks to Seb Vidal for the CAFilter implementation.

Contributing

Contributions welcome. See the Contributing Guide for details.

License

MIT. See LICENSE for details.

About

Lets SwiftUI elements glow brighter than the screen using HDR, taking advantage of extended brightness on compatible displays.

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Languages