StateVariable 1.3.0
.NET 6.0
This package targets .NET 6.0. The package is compatible with this framework or higher.
.NET Standard 2.1
This package targets .NET Standard 2.1. The package is compatible with this framework or higher.
dotnet add package StateVariable --version 1.3.0
NuGet\Install-Package StateVariable -Version 1.3.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="StateVariable" Version="1.3.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add StateVariable --version 1.3.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: StateVariable, 1.3.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install StateVariable as a Cake Addin #addin nuget:?package=StateVariable&version=1.3.0 // Install StateVariable as a Cake Tool #tool nuget:?package=StateVariable&version=1.3.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Mission of this Library
- To provide a simple and easy-to-use state management library for Unity.(Like Redux or Svelte.store)
Features 🌟
- State Set/Read/Observe
- StateCollection
- DependencyState/HalfDependencyState
State List
class | summary | implements interface |
---|---|---|
ObservableState <br/>SubjectState | A state variable that can be observed | IStateReader, IStateObserver, IStateSetter, IDisposable |
State | A state variable that cannot be observed but is more memory-efficient than ObservableState | IStateReader, IStateSetter |
DependencyState | A state variable that derives results from other variables and triggers them | IStateReader, IStateObserver |
HalfDependencyState | A state variable that derive results from other variables and their own variable and trigger them | IStateReader, IStateSetter, IStateObserver |
ObservableListState | A collection of StateVariables (internally implemented as a List) | IStateReader, IStateSetter, IStateCollectionObserver, IStateCollectionElementObserver, IStateCollectionElementSetter, IStateCollectionModifier |
ObservableDictionaryState | A collection of StateVariables (internally implemented as a Dictionary) | IStateReader, IStateSetter, IStateCollectionObserver, IStateCollectionElementObserver, IStateCollectionElementSetter, IStateCollectionModifier |
Usage Example(This Example used a Zenject)
Each State is bound to the appropriate context of the DI container, and each object obtains the necessary dependencies.
// ----- Installer
var testState = new ObservableState<Test>(new Test());
testState.AddTo(this);
Container.BindInstance<IStateReader<Test>>(testState);
Container.BindInstance<IStateObserver<Test>>(testState);
Container.BindInstance<IStateSetter<Test>>(testState);
[Inject] IStateObserver<Test> _testObserver;
[Inject] IStateReader<Test> _testReader;
[Inject] IStateSetter<Test> _testSetter;
void Start()
{
// How to use variable
_testObserver.Observe().Subscribe(test => {}).AddTo(this);
Test test = _testReader.Read();
_testSetter.Set(new Test());
// Observer can also read
test = _testObserver.Read();
// Setter can also read
test = _testSetter.Read();
}
Installation ☘️
Install via nuget
- Run the following:
dotnet add package StateVariable --version 1.3.0
Required
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.1 is compatible. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
.NETStandard 2.1
- ObservableCollections (>= 2.2.2)
- ObservableCollections.R3 (>= 2.2.2)
- R3 (>= 1.2.8)
-
net6.0
- ObservableCollections (>= 2.2.2)
- ObservableCollections.R3 (>= 2.2.2)
- R3 (>= 1.2.8)
-
net8.0
- ObservableCollections (>= 2.2.2)
- ObservableCollections.R3 (>= 2.2.2)
- R3 (>= 1.2.8)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.