are you trying to make something that uses Apple wallet?
if so, I would start at about 15 minutes into
this session.
if you are trying to do something
within your app, you can’t do NFC passes without Apple Wallet, but you
can make a QR code. here is a example function that generates a QR code from a string:
Code Block swiftfunc generateQRCode(from string: String) -> UIImage? { |
let data = string.data(using: String.Encoding.ascii) |
|
if let filter = CIFilter(name: "CIQRCodeGenerator") { |
filter.setValue(data, forKey: "inputMessage") |
let transform = CGAffineTransform(scaleX: 3, y: 3) |
|
if let output = filter.outputImage?.transformed(by: transform) { |
return UIImage(ciImage: output) |
} |
} |
|
return nil |
} |
after you have that function, you use it like this:
Code Block swift let image = generateQRCode(from: "i am going to be so helpful to st0321!") |
that generates a QR code with the text "i am going to be so helpful to st0321!" and gives it to you as a UIImage.