INNER CODE UNIT · Swift

encode

a2/swift-shortcuts · Sources/SwiftShortcuts/Actions/Calculate.swift:95

    public func encode(to encoder: Encoder) throws {
        var container = encoder.singleValueContainer()

        switch self {
        case .variable(let variable):
            try container.encode(variable)
        case .number(let number):
            try container.encode(number)
        }
    }
}

/// Represents a value that can be used as a operand in a `Calculation`.
public protocol CalculationOperandConvertible {
    /// A calculation operand that represents this value.
    var calculationOperand: CalculationOperand { get }
}

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…