Skip to content
SwiftUI Effects
Swift
Branch: master
Clone or download

Latest commit

Fetching latest commit…
Cannot retrieve the latest commit at this time.

Files

Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.swiftpm/xcode/package.xcworkspace
Assets
Sources/SwiftFX
Tests
.gitignore
LICENSE
Package.resolved
Package.swift
README.md

README.md

Powered by Metal through PixelKit

Example

import SwiftUI
import SwiftFX
struct ContentView: View {
    @State var value: CGFloat = 0.5
    var body: some View {
        VStack {
            Text("Hello, World!")
                .font(.system(size: 50, weight: .bold, design: .rounded))
                .fxEdge()
                .fxBlur(style: .zoom, radius: $value)
            Slider(value: $value)
        }
    }
}
Text("Hello, World!") .fxEdge() .fxBlur(style: .zoom)

Install

.package(url: "https://github.com/hexagons/SwiftFX.git", from: "0.1.0")

Setup

#if os(iOS)
fxMetalLib(url: Bundle.main.url(forResource: "PixelKitShaders-iOS", withExtension: "metallib")!)
#elseif os(macOS)
fxMetalLib(url: URL(fileURLWithPath: "/path/to/PixelKitShaders-macOS.metallib"))
#endif

You can find the latest Metal library from PixelKit here.

Effects

func fxBlur(style, radius, angle, position, quality) -> FX

func fxEdge(strength, distance) -> FX

func fxDisplace(distance, view) -> FX

func fxDisplaceNoise(distance, octaves, zPosition) -> FX

func fxRainbowBlur(_) -> FX

func fxClamp(low, high) -> FX

func fxKaleidoscope(divisions, mirror) -> FX

func fxBrightness(_) -> FX

func fxDarkness(_) -> FX

func fxContrast(_) -> FX

func fxGamma(_) -> FX

func fxInvert() -> FX

func fxOpacity(_) -> FX

func fxQuantize(fraction) -> FX

func fxSharpen(_) -> FX

func fxSlope(_) -> FX

func fxThreshold(_) -> FX

func fxTwirl(_) -> FX

func fxRange(inLow, inHigh, outLow, outHigh) -> FX

func fxSaturation(_) -> FX

func fxMonochrome() -> FX

func fxHue(_) -> FX

func fxSepia(color) -> FX

func fxFlipX() -> FX

func fxFlipY() -> FX

func fxFlopLeft() -> FX

func fxFlopRight() -> FX
You can’t perform that action at this time.