Swiftgram/submodules/PremiumUI/Sources/DemoComponent.swift
2022-05-25 16:32:10 +04:00

45 lines
1.2 KiB
Swift

import Foundation
import UIKit
import Display
import AsyncDisplayKit
import SwiftSignalKit
import ComponentFlow
import AccountContext
final class DemoComponent: Component {
public typealias EnvironmentType = DemoPageEnvironment
let context: AccountContext
public init(
context: AccountContext
) {
self.context = context
}
public static func ==(lhs: DemoComponent, rhs: DemoComponent) -> Bool {
if lhs.context !== rhs.context {
return false
}
return true
}
public final class View: UIView {
private var component: DemoComponent?
public func update(component: DemoComponent, availableSize: CGSize, transition: Transition) -> CGSize {
self.component = component
return availableSize
}
}
public func makeView() -> View {
return View()
}
public func update(view: View, availableSize: CGSize, state: EmptyComponentState, environment: Environment<DemoPageEnvironment>, transition: Transition) -> CGSize {
return view.update(component: self, availableSize: availableSize, transition: transition)
}
}