0

I am trying to create the login with QR code. I did Google and got to know How to implement QR code in Swift. My Doubt or Question is: How do you store your QR code metadata or key or value of particular QR code? Where shall I save ? I have 10 different QR code Images. If QR code "A" matches to key value "A" then only View must Segue to next page.

Thank you.

swift_USer
  • 159
  • 3
  • 15
  • may be you can use `base64 encode` , save the encoded value to database and use it when neccessary . – Vikrant Sep 26 '16 at 11:39
  • @Vikrant : As I am building Sample App, So I don't use database here. I have to hard code all the data. Can you give me example for base 64 encode ? and how to call it in my QRcode program? – swift_USer Sep 26 '16 at 11:53
  • Here you go http://stackoverflow.com/questions/882277/how-to-base64-encoding-on-the-iphone.... – Vikrant Sep 26 '16 at 11:58

1 Answers1

0

You just need to save the string values of QR code. You can easily save them in UserDefault:

let defaults = UserDefaults.standard
defaults.set(firstQRValue, forKey: "value1")

When you scan a QRCode, match its value with those saved in your UserDefaults.

S.S.D
  • 1,579
  • 2
  • 12
  • 23