Skip to content
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

Doesn't seems to work on latest iOS version ( 14.2 ) #9

Closed
clementleroy opened this issue Nov 18, 2020 · 2 comments
Closed

Doesn't seems to work on latest iOS version ( 14.2 ) #9

clementleroy opened this issue Nov 18, 2020 · 2 comments
Labels
bug Something isn't working

Comments

@clementleroy
Copy link

clementleroy commented Nov 18, 2020

ValidatedPropertyKit Environment

  • ValidatedPropertyKit version: 0.0.4
  • macOS version: 11.0.1
  • Xcode version: 12.2
  • Dependency manager (Carthage, CocoaPods, SPM, Manually): SPM

What did you do?

I have
@Validated(.isEmail) var email: String? { didSet { emailError = _email.isValid } }
in an ObservableObject
In a view I have a TextField linked to email

What did you expect to happen?

I expected the emailError to contains a bool & email to contains the text that was typed.

What happened instead?

emailError do contains a bool but it's always false because when I type, the letter disappears.
The value is present when I call willSet but isn't anymore in the didSet.
If I remove the call to isValid it works.

It works as expected on devices running 14.1 or lower but not on devices running 14.2

@SvenTiigi
Copy link
Owner

Hi @clementleroy,

The current implementation of ValidatedPropertyKit validates the value as soon as the value is written to the property annotated with @Validated

self.validatedValue = self.isValid(value: newValue)

As soon as ValidatedPropertyKit hits a 1.0 release this behavior will be changed so that the value only gets validated as soon as it gets accessed.
Please feel free to open up a PR.

@SvenTiigi SvenTiigi added the bug Something isn't working label Jan 17, 2021
@SvenTiigi
Copy link
Owner

Hey @clementleroy,

Please check out the latest release 0.0.5 of ValidatedPropertyKit which should resolve your issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants