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.
51 lines
1.3 KiB
Swift
51 lines
1.3 KiB
Swift
//
|
|
// AnyNodeProperty.swift
|
|
// lottie-swift
|
|
//
|
|
// Created by Brandon Withrow on 1/30/19.
|
|
//
|
|
|
|
import CoreGraphics
|
|
import Foundation
|
|
|
|
// MARK: - AnyNodeProperty
|
|
|
|
/// A property of a node. The node property holds a provider and a container
|
|
protocol AnyNodeProperty {
|
|
|
|
/// Returns true if the property needs to recompute its stored value
|
|
func needsUpdate(frame: CGFloat) -> Bool
|
|
|
|
/// Updates the property for the frame
|
|
func update(frame: CGFloat)
|
|
|
|
/// The stored value container for the property
|
|
var valueContainer: AnyValueContainer { get }
|
|
|
|
/// The value provider for the property
|
|
var valueProvider: AnyValueProvider { get }
|
|
|
|
/// The original value provider for the property
|
|
var originalValueProvider: AnyValueProvider { get }
|
|
|
|
/// The Type of the value provider
|
|
var valueType: Any.Type { get }
|
|
|
|
/// Sets the value provider for the property.
|
|
func setProvider(provider: AnyValueProvider)
|
|
}
|
|
|
|
extension AnyNodeProperty {
|
|
|
|
/// Returns the most recently computed value for the keypath, returns nil if property wasn't found
|
|
func getValueOfType<T>() -> T? {
|
|
valueContainer.value as? T
|
|
}
|
|
|
|
/// Returns the most recently computed value for the keypath, returns nil if property wasn't found
|
|
func getValue() -> Any? {
|
|
valueContainer.value
|
|
}
|
|
|
|
}
|