Skip to content

whatsinlab/livable

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Livable Icon

Livable

Make views livable.

Livable is a SwiftUI package that turns a view's own pixels into a soft, animated, liquid-like gradient surface. The effect is implemented with a SwiftUI layer shader and Metal, so it can be applied directly to any SwiftUI view without extracting colors or providing a separate palette.

Preview

Requirements

  • iOS 17+

Installation

Add Livable as a Swift Package dependency in Xcode, or add it to your Package.swift dependencies:

.package(url: "https://github.com/whatsinlab/livable.git", from: "0.1.0")

Then add Livable to the target that uses the effect.

Usage

Import Livable and apply the modifier to any SwiftUI view:

import Livable
import SwiftUI

struct ContentView: View {
    var body: some View {
        Image("Artwork")
            .resizable()
            .aspectRatio(contentMode: .fit)
            .livable()
    }
}

You can control whether the effect renders, how quickly it moves, and how much post-process blur is applied:

SomeView()
    .livable(isEnabled: true, speed: 0.8, blurRadius: 48)

The effect renders inside the modified view's layout bounds. To use it as a full-screen backdrop, give the source view a full-screen frame at the call site.

License

Livable is available under the MIT License.

About

Make views live.

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors