File tree Expand file tree Collapse file tree 1 file changed +32
-2
lines changed
Sources/OpenSwiftUICore/Animation/Transition Expand file tree Collapse file tree 1 file changed +32
-2
lines changed Original file line number Diff line number Diff line change 22// TransitionTraitKey.swift
33// OpenSwiftUICore
44//
5- // Audited for 6.0.87
6- // Status: WIP
5+ // Audited for 6.5.4
6+ // Status: Complete
77
8+ // MARK: - ViewTraitCollection + canTransition
9+
10+ @available ( OpenSwiftUI_v1_0, * )
811@usableFromInline
912struct CanTransitionTraitKey : _ViewTraitKey {
1013 @inlinable
@@ -20,3 +23,30 @@ extension ViewTraitCollection {
2023 set { self [ CanTransitionTraitKey . self] = newValue }
2124 }
2225}
26+
27+ // MARK: - ViewTraitCollection + transition
28+
29+ struct TransitionTraitKey : _ViewTraitKey {
30+ static var defaultValue : AnyTransition { . opacity }
31+ }
32+
33+ extension ViewTraitCollection {
34+ package var transition : AnyTransition {
35+ self [ TransitionTraitKey . self]
36+ }
37+
38+ package func optionalTransition( ignoringIdentity: Bool ) -> AnyTransition ? {
39+ guard canTransition else {
40+ return nil
41+ }
42+ let transition = transition
43+ if ignoringIdentity, transition. isIdentity {
44+ return nil
45+ }
46+ return transition
47+ }
48+
49+ package func optionalTransition( ) -> AnyTransition ? {
50+ optionalTransition ( ignoringIdentity: true )
51+ }
52+ }
You can’t perform that action at this time.
0 commit comments