Skip to content

ObservableAttribue support for private properties #15

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Hellfim opened this issue May 27, 2023 · 1 comment · Fixed by #18
Closed

ObservableAttribue support for private properties #15

Hellfim opened this issue May 27, 2023 · 1 comment · Fixed by #18
Assignees
Labels
enhancement New feature or request

Comments

@Hellfim
Copy link
Contributor

Hellfim commented May 27, 2023

Hi! I would like to have an ObservableAttribute support for private properties.

Currently it only supports private fields.

In cases you don't want to expose your private/protected properties, but still want to make them available just to the View having ObservableAttribute on such properties would be a good thing

@Hellfim Hellfim added the enhancement New feature or request label May 27, 2023
@ChebanovDD
Copy link
Collaborator

Hi there,

In the next release, it will be possible to apply ObservableAttribute to fields and properties. And the binding logic will be unified for Properties and Commands.

public class MyViewModel : IBindingContext
{
    [Observable("Count")]
    private readonly IProperty<int> _amount;

    [Observable]
    private readonly ICommand _myCommand;

    [Observable]
    protected IProperty<string> Name { get; }

    [Observable("PreviousPropertyName")]
    public IReadOnlyProperty<string> NewPropertyName { get; }
}

@ChebanovDD ChebanovDD moved this to 🏗 In progress in UnityMvvmToolkit May 29, 2023
@ChebanovDD ChebanovDD moved this from 🏗 In progress to 👀 In review in UnityMvvmToolkit May 29, 2023
@ChebanovDD ChebanovDD moved this from 👀 In review to ✅ Done in UnityMvvmToolkit May 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants