2

I'm trying to generate random code mixed of numbers (0-9) and letters(A-z) so I can send it to user email to use it when login .

Is there a library or any way to do this ?

Zizoo
  • 1,694
  • 5
  • 20
  • 42

1 Answers1

3

This is give random value...

func returnUUIDWithTimeStamp() -> String {
  return UUID().uuidString + NSString(format: "%f", Date().timeIntervalSince1970 * 1000).substring(with: NSRange(location: 8, length: 5))
}

Result will contain '-'

C95B920A-3866-4A50-A783-D719FB0B607512830

Mohamed Jaleel Nazir
  • 5,776
  • 3
  • 34
  • 48