Single

public class Single

Utility functions for asserting/converting query result into a single item.

  • Utility function for asserting/converting query result into a single optional item.

    Throws

    QueryResultError if the query result doesn’t have a single optional item.

    Declaration

    Swift

    public static func optional<T>(_ array: [T]) throws -> T?

    Parameters

    array

    query result array.

  • Utility function for asserting/converting query result into a single required item.

    Throws

    QueryResultError if the query result doesn’t have a single required item.

    Declaration

    Swift

    public static func required<T>(_ array: [T]) throws -> T

    Parameters

    array

    query result array.