Skip to content

AnyRuntimeModifiable

0x41c edited this page Feb 28, 2022 · 1 revision

AnyRuntimeModifiable

A protocol to which all RuntimeModifiable structures conform

public protocol AnyRuntimeModifiable 

Default Implementations

from(anyValue:)

public static func from(
        anyValue: Any
    ) -> AnyRuntimeModifiable 

Requirements

get(_:​_:​)

Dynamically retrieves a stored property value defined on this struct.

func get<MemberType>(
        _ member: String,
        _ type: MemberType.Type?
    ) -> MemberType?

Depending on the need, you can optionally use the type parameter to implicity define the generic return value.

Parameters

  • member: The name of the member you would like to retreive.
  • type: Optionally, the type of the member you would like to retreive.

Returns

The dynamically retreived member if found. Otherwise, nil

set(_:​_:​)

Dynamically retrieves a stored property value defined on this struct.

mutating func set<MemberType>(
        _ member: String,
        _ newValue: MemberType
    )

Depending on the need, you can optionally use the type parameter to implicity define the generic return value.

Parameters

  • member: The name of the member you would like to retreive.
  • type: Optionally, the type of the member you would like to retreive.

Returns

The dynamically retreived member if found. Otherwise, nil

from(anyValue:​)

Creates an interface for getting and setting members of the provided value.

static func from(
        anyValue: Any
    ) -> AnyRuntimeModifiable

The provided value must be a struct, or else this will fail.

Parameters

  • anyValue: The struct to read and modify
  • returnType: The return type of the body, which defaults to AnyRuntimeModifiable
  • body: A body with the  AnyRuntimeModifiable passed in. This is ommitted by default, but can be added when needed.
Types
Protocols
Global Typealiases
Global Functions
Clone this wiki locally