From the course: iOS Development Tips

Unlock this course with a free trial

Join today to access over 22,400 courses taught by industry experts.

Generate QR codes

Generate QR codes

- [Instructor] QR codes are all the rage. This week, let's learn how to generate them from your app. Download the exercise files. I've already set up a storyboard of a simple app to display a square image view. I also set up a function to make a QR code. So let's go over to the view controller here. I'll close this up. And you could see right here, I've got my outlet, I've got a qrcodeImage that I've made optional, and right under that, I've got that QR code. And the first thing I'm going to do just for good cleaning purposes is I going to make tat qrcodeImage nil. Now, if the text is going to be empty, I'm going to return with a blank image, and so we're going to do if text isEmpty return so we don't spend a lot of time processing. And we generate the QR codes and other barcodes as CI filters. So I'm going to have to make a filter. Then initializer for the filter returns an optional. So I'm going to use guard to unwrap it. So G-U-A-R-D, and then let filter equal, and I'm going to use…

Contents