mirror of
https://github.com/GLEGram/GLEGram-iOS.git
synced 2026-05-01 15:27:55 +02:00
4647310322
Based on Swiftgram 12.5 (Telegram iOS 12.5). All GLEGram features ported and organized in GLEGram/ folder. Features: Ghost Mode, Saved Deleted Messages, Content Protection Bypass, Font Replacement, Fake Profile, Chat Export, Plugin System, and more. See CHANGELOG_12.5.md for full details.
48 lines
789 B
Swift
48 lines
789 B
Swift
//
|
|
// ValueContainer.swift
|
|
// lottie-swift
|
|
//
|
|
// Created by Brandon Withrow on 1/30/19.
|
|
//
|
|
|
|
import CoreGraphics
|
|
import Foundation
|
|
|
|
/// A container for a node value that is Typed to T.
|
|
class ValueContainer<T>: AnyValueContainer {
|
|
|
|
// MARK: Lifecycle
|
|
|
|
init(_ value: T) {
|
|
outputValue = value
|
|
}
|
|
|
|
// MARK: Internal
|
|
|
|
private(set) var lastUpdateFrame = CGFloat.infinity
|
|
|
|
fileprivate(set) var needsUpdate = true
|
|
|
|
var value: Any {
|
|
outputValue as Any
|
|
}
|
|
|
|
var outputValue: T {
|
|
didSet {
|
|
needsUpdate = false
|
|
}
|
|
}
|
|
|
|
func setValue(_ value: Any, forFrame: CGFloat) {
|
|
if let typedValue = value as? T {
|
|
needsUpdate = false
|
|
lastUpdateFrame = forFrame
|
|
outputValue = typedValue
|
|
}
|
|
}
|
|
|
|
func setNeedsUpdate() {
|
|
needsUpdate = true
|
|
}
|
|
}
|