Int

struct Int : SignedInteger, Comparable, Equatable
  • A method used to retrieve a value from a given array for a specific index. - parameter array: An Array of JSON. - throws: .IndexOutOfBounds with an associated value of self, where self is an Int, should the index not be within the valid range for the array of JSON. - returns: The JSON value found at the given index.

    Declaration

    Swift

    public func value(in array: [JSON]) throws -> JSON

    Parameters

    array

    An Array of JSON.

    Return Value

    The JSON value found at the given index.

  • Converts an instance of a conforming type to JSON. - returns: An instance of JSON where the enum case is .int.

    Declaration

    Swift

    public func toJSON() -> JSON

    Return Value

    An instance of JSON where the enum case is .int.

  • An initializer to create an instance of Int from a JSON value. - parameter json: An instance of JSON. - throws: The initializer will throw an instance of JSON.Error if an instance of Int cannot be created from the JSON value that was passed to this initializer.

    Declaration

    Swift

    public init(json: JSON) throws

    Parameters

    json

    An instance of JSON.