Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
internal class UpdateViewModel: ObservableObject
{
/// Cantidad de caracteres que aún podemos escribir
@Published internal var commentCharactersRemaining = 35
/// El comentario que estás escribiendo
/// Si llevamos más de 35 caracteres escritos
/// volvemos al valor anterior.
@Published internal var comment = ""
{
didSet
{
if self.comment.count > 35
{
self.comment = oldValue
self.commentCharactersRemaining = 0
}
else
{
self.commentCharactersRemaining = 35 - self.comment.count
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.