Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
//
// NumericTextTransitionExample.swift
// Shared

#if OPENSWIFTUI
import OpenSwiftUI
#else
import SwiftUI
#endif

// Tap to compare the numeric transition with the default text transition.
// FIXME: OpenSwiftUI currently replaces both values directly. Text does not
// yet attach its interpolator group, and content interpolation is incomplete.
struct NumericTextTransitionExample: View {
@State private var counter = 0

var body: some View {
VStack {
Text("\(counter)")
.contentTransition(.numericText())
.font(.title)
Text("\(counter)")
.font(.title)
}
.padding()
.onTapGesture {
withAnimation(.interactiveSpring) {
counter += 1
}
}
}
}

#Preview {
NumericTextTransitionExample()
}
4 changes: 2 additions & 2 deletions Package.resolved

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -792,7 +792,7 @@ extension SymbolEffect {
case .effects:
let effect = ContentTransition.Effect(
type: ContentTransition.EffectType(
type: .symbolAppearDisappear,
type: .appearDisappear,
arg0: .int(config.base.transitionFlags.rawValue),
arg1: .float(1)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ public struct SymbolEffectTransition: Transition {
}
let effect = ContentTransition.Effect(
type: ContentTransition.EffectType(
type: .symbolAppearDisappear,
type: .appearDisappear,
arg0: .int(hidden.transitionFlags.rawValue),
arg1: .float(_SymbolEffect.Options(options).speed)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@ extension Transaction {
}

package var disablesContentTransitions: Bool {
get { self[DisablesContentTransactionKey.self] }
set { self[DisablesContentTransactionKey.self] = newValue }
}
get { self[DisablesContentTransitionsKey.self] }
set { self[DisablesContentTransitionsKey.self] = newValue }
}

package mutating func disableAnimations() {
animation = nil
Expand Down Expand Up @@ -107,6 +107,6 @@ private struct AnimationReasonKey: TransactionKey {
static var defaultValue: UInt32? { nil }
}

private struct DisablesContentTransactionKey: TransactionKey {
private struct DisablesContentTransitionsKey: TransactionKey {
static var defaultValue: Bool { false }
}
Loading
Loading