FMPState

Description

The FMPState class is used to work with framework state.

class FMPState

Methods

Method Description

get()

Get the current framework state as a JSON structure.
func get() -> String?
set(_:) Restore or reset the current framework state. It restores state from the sent JSON structure. If an empty string is specified in the state parameter, the current state will be reset. It returns true if state restore or reset was successful.
func set(_ state: String) -> Bool

Parameters:

  • state. Framework states as a JSON structure.

Example

Get, reset, and restore the current framework state:

// Build an instance of the FMPState class. For details see examples for FMPState.Builder.
let state: FMPScheme = fmp.state.build()
  
// Get the current state
let currentState: String? = state.get()
  
// Reset the current state
let dropStateSuccess: Bool = state.set("")
  
// Restore the current state
let setStateSuccess: Bool = state.set(currentState!)

See also:

FMPWrapper Framework | Classes