Skip to content

0.7.0

Pre-release
Pre-release

Choose a tag to compare

@Kyle-Ye Kyle-Ye released this 20 Jul 18:26
· 145 commits to main since this release
4bd1f28

Milestone:

  • Add async render support 1
  • Add Animation support for iOS platform.
  • Add onChange modifier API support
import OpenSwiftUI
struct ContentView: View {
    @State private var showRed = false
    var body: some View {
        VStack {
            Color(platformColor: showRed ? .red : .blue)
                .frame(width: showRed ? 200 : 400, height: showRed ? 200 : 400)
        }
        .animation(.easeInOut(duration: 2), value: showRed)
        .onAppear {
            DispatchQueue.main.asyncAfter(deadline: .now() + 2) {
                showRed.toggle()
            }
        }
    }
}
Simulator.Screen.Recording.-.iPhone.16.Pro.-.2025-07-20.at.03.03.42.mp4
import OpenSwiftUI
import Foundation

private struct ElasticEaseInEaseOutAnimation: CustomAnimation {
    let duration: TimeInterval

    func animate<V>(value: V, time: TimeInterval, context: inout AnimationContext<V>) -> V? where V: VectorArithmetic {
        if time > duration { return nil }
        let p = time / duration
        let s = sin((20 * p - 11.125) * ((2 * Double.pi) / 4.5))
        if p < 0.5 {
            return value.scaled(by: -(pow(2, 20 * p - 10) * s) / 2)
        } else {
            return value.scaled(by: (pow(2, -20 * p + 10) * s) / 2 + 1)
        }
    }
}

extension Animation {
    static var elasticEaseInEaseOut: Animation { elasticEaseInEaseOut(duration: 0.35) }

    static func elasticEaseInEaseOut(duration: TimeInterval) -> Animation {
        Animation(ElasticEaseInEaseOutAnimation(duration: duration))
    }
}

struct ContentView: View {
    @State private var isActive = false

    var body: some View {
        VStack(alignment: isActive ? .trailing : .leading) {
            Color.red
                .frame(width: 100.0, height: 100.0)
            Color.blue
                .frame(width: 300.0, height: 100.0)
        }
        .animation(.elasticEaseInEaseOut(duration: 2.0), value: isActive)
        .onAppear {
            DispatchQueue.main.asyncAfter(deadline: .now() + 1.0) {
                isActive.toggle()
            }
        }
    }
}
Simulator.Screen.Recording.-.iPhone.16.Pro.-.2025-07-21.at.02.24.54.mp4

What's Changed

Full Changelog: 0.6.0...0.7.0

  1. Via SwiftUI's Render. Currently only align with iOS 18.5 and macOS 15.5 Runtime.