Stream improvements

This commit is contained in:
Ali
2022-02-26 02:22:10 +04:00
parent 6fb5008c0f
commit 089642a0bb
35 changed files with 1227 additions and 309 deletions

View File

@@ -617,7 +617,7 @@ public extension CombinedComponent {
return UIView()
}
func update(view: View, availableSize: CGSize, environment: Environment<EnvironmentType>, transition: Transition) -> CGSize {
func update(view: View, availableSize: CGSize, state: State, environment: Environment<EnvironmentType>, transition: Transition) -> CGSize {
let context = view.getCombinedComponentContext(Self.self)
let storedBody: Body
@@ -823,4 +823,8 @@ public extension CombinedComponent {
static func Guide() -> _ChildComponentGuide {
return _ChildComponentGuide()
}
static func StoredActionSlot<Arguments>(_ argumentsType: Arguments.Type) -> ActionSlot<Arguments> {
return ActionSlot<Arguments>()
}
}

View File

@@ -118,7 +118,7 @@ public protocol Component: _TypeErasedComponent, Equatable {
func makeView() -> View
func makeState() -> State
func update(view: View, availableSize: CGSize, environment: Environment<EnvironmentType>, transition: Transition) -> CGSize
func update(view: View, availableSize: CGSize, state: State, environment: Environment<EnvironmentType>, transition: Transition) -> CGSize
}
public extension Component {
@@ -131,7 +131,9 @@ public extension Component {
}
func _update(view: UIView, availableSize: CGSize, environment: Any, transition: Transition) -> CGSize {
return self.update(view: view as! Self.View, availableSize: availableSize, environment: environment as! Environment<EnvironmentType>, transition: transition)
let view = view as! Self.View
return self.update(view: view, availableSize: availableSize, state: view.context(component: self).state, environment: environment as! Environment<EnvironmentType>, transition: transition)
}
func _isEqual(to other: _TypeErasedComponent) -> Bool {

View File

@@ -147,6 +147,12 @@ public struct Transition {
return result
}
public func withAnimation(_ animation: Animation) -> Transition {
var result = self
result.animation = animation
return result
}
public static var immediate: Transition = Transition(animation: .none)
public static func easeInOut(duration: Double) -> Transition {