Structures

The following structures are available globally.

  • Undocumented

    See more

    Declaration

    Swift

    public struct BindableValue<Value> : Bindable
  • Undocumented

    See more

    Declaration

    Swift

    public struct ThrowingBinding<Value>
  • Undocumented

    Declaration

    Swift

    public struct TimedoutError : Error, Equatable
  • Undocumented

    Declaration

    Swift

    public struct Subscription
  • A loadable object that contains loading informations

    See more

    Declaration

    Swift

    public struct LoadableContent<DataType> where DataType : Equatable

Atoms

Sync Selector

  • A selector is a pure function that accepts atoms or other sync selectors as input. When these upstream atoms or sync selectors are updated, the selector function will be re-evaluated. Components can subscribe to selectors just like atoms, and will then be re-rendered when the selectors change. Selectors are used to calculate derived data that is based on state. This lets us avoid redundant state because a minimal set of state is stored in atoms, while everything else is efficiently computed as a function of that minimal state.

     let currentBooksSel = selector { accessor -> [Book] in
        let books = accessor.get(allBookStore)
          if let category = accessor.get(selectedCategoryState) {
              return books.filter { $0.category == category }
          }
        return books
    }
    
    See more

    Declaration

    Swift

    public struct Selector<T> : SyncSelectorNode where T : Equatable
  • MutableSelector is a bi-directional sync selector receives the incoming value as a parameter and can use that to propagate the changes back upstream along the data-flow graph.

     let tempFahrenheitState = atom(32)
     let tempCelsiusSelector = selector(
          get: { get in
            let fahrenheit = accessor.get(tempFahrenheitState)
            return (fahrenheit - 32) * 5 / 9
          },
          set: { context, newValue in
            let newFahrenheit = (newValue * 9) / 5 + 32
            context.accessor.set(tempFahrenheitState, newFahrenheit)
          }
    )
    
    See more

    Declaration

    Swift

    public struct MutableSelector<T> : SyncSelectorNode where T : Equatable
    extension MutableSelector: Writeable

Async Selector

  • A AsyncSelector is a pure function that other async selectors as input. those selector be impletemented by Combine or async/await Selector and AsyncSelector can not allow you pass a user-defined argument, if you want to pass a customable parameters. please refer to selectorFamily

    See more

    Declaration

    Swift

    public struct AsyncSelector<T> : AsyncSelectorNode where T : Equatable
  • Undocumented

    See more

    Declaration

    Swift

    public struct RecoilCallbackContext
  • Undocumented

    See more

    Declaration

    Swift

    public struct SnapshotView : View
  • Undocumented

    See more

    Declaration

    Swift

    public struct MutableContext
  • Undocumented

    See more

    Declaration

    Swift

    public struct RecoilRoot<Content> : View where Content : View
  • Undocumented

    See more

    Declaration

    Swift

    public struct RecoilRootLeagcy<Content> : View where Content : View
  • Undocumented

    See more

    Declaration

    Swift

    @propertyWrapper
    public struct RecoilScope : DynamicProperty
  • Undocumented

    See more

    Declaration

    Swift

    @propertyWrapper
    public struct RecoilScopeLeagcy : DynamicProperty
  • Undocumented

    See more

    Declaration

    Swift

    @propertyWrapper
    public struct RecoilSnapshot : DynamicProperty
  • Undocumented

    See more

    Declaration

    Swift

    @propertyWrapper
    public struct RecoilScopedState<Node> : DynamicProperty where Node : RecoilNode