Skip to content

ModelMaybeOptional

Josh Wright edited this page Jan 14, 2021 · 3 revisions

ModelMaybeOptional

Either a Model or a Model?.

public protocol ModelMaybeOptional: Codable

This protocol exists so that Model? and Model can be treated similarly in relationship property wrappers. Sometimes a relationship may be optional, sometimes it may be required. Alchemy supports both cases.

Inheritance

Codable

Requirements

from(_:​)

Given an optional object of type Value, convert that to this type. Used for managing the type system when putting eagerly loaded data into relationship properties.

static func from(_ value: Value?) throws -> Self

Parameters

  • value: The value to convert.

Throws

An error if the optional value was unable to be converted to Self.

Returns

The value converted to type Self.

Alchemy
Types
Protocols
Global Typealiases
Global Variables
Global Functions
Fusion
Types
Protocols
Papyrus
Types
Protocols
Clone this wiki locally