SmartCoding

public enum SmartCoding

Global coding/decoding configuration namespace for SmartCodable

  • Number conversion strategy during decoding (default: .strict)

    • Description: Controls how to handle precision loss when converting JSON numbers (e.g., floating-point) to target types (e.g., integer)
    • Examples:

      • Converting JSON’s 3.14 to Int:
      • .strict: Returns nil (no precision loss allowed)
      • .truncate: Returns 3 (direct truncation)
      • .rounded: Returns 3 (rounds to nearest)

    Note

    This only affects decoding process

    Declaration

    Swift

    public static var numberConversionStrategy: NumberConversionStrategy { get set }
  • Numeric type conversion strategy

    See more

    Declaration

    Swift

    public enum NumberConversionStrategy