GraphQLEnum


ENUM

GraphQLEnum

Swift
1public enum GraphQLEnum<T: EnumType>: CaseIterable, Hashable, RawRepresentable

A generic enum that wraps a generated enum from a GraphQL Schema.

GraphQLEnum provides an __unknown case that is used when the response returns a value that is not recognized as a valid enum case. This is usually caused by future cases added to the enum on the schema after code generation.

Cases

case(_:)

Swift
1case `case`(T)

A recognized case of the wrapped enum.

__unknown(_:)

Swift
1case __unknown(String)

An unrecognized value for the enum. The associated value exposes the raw String data from the response.

Properties

value

Swift
1@inlinable public var value: T?

The underlying enum case. If the value is __unknown, this will be nil.

rawValue

Swift
1@inlinable public var rawValue: String

allCases

Swift
1@inlinable public static var allCases: [GraphQLEnum<T>]

A collection of all known values of the wrapped enum. This collection does not include the __unknown case.

Methods

init(_:)

Swift
1@inlinable public init(_ caseValue: T)

init(rawValue:)

Swift
1@inlinable public init(rawValue: String)

Parameters

NameDescription
rawValueThe raw value to use for the new instance.

init(_:)

Swift
1@inlinable public init(_ rawValue: String)
Feedback

Edit on GitHub

Forums