Skip to content

Instantly share code, notes, and snippets.

@stevencurtis
Created July 14, 2020 16:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stevencurtis/9c8d2684a539b7522b11f3125a9b0d19 to your computer and use it in GitHub Desktop.
Save stevencurtis/9c8d2684a539b7522b11f3125a9b0d19 to your computer and use it in GitHub Desktop.
validlengthusername
@Published var username: String = ""
var validLengthUsername: AnyPublisher<Bool, Never> {
return $username.debounce(for: 0.2, scheduler: RunLoop.main)
.removeDuplicates()
.map{$0.count >= passwordLength ? true : false}
.eraseToAnyPublisher()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment