Difference between revisions of "Barcode Scanner Code"

From ESE205 Wiki
Jump to navigation Jump to search
(Created page with "== Grocery Guru == Category:HowTos")
 
Line 1: Line 1:
 
== Grocery Guru ==
 
== Grocery Guru ==
 +
 +
=== Description ===
 +
 +
In order to scan a barcode in an application, you must use an AV Foundation to implement into your code.
 +
 +
== Steps ===
 +
 +
# Create a new View Controller in Xcode to have the barcode scanner on a separate page in the app.
 +
# Import the AV Foundation at the top of your code so that you can use barcodes that are already provided instead of trying to individually code barcode images and UPC numbers.
 +
# Create an object that captures low quality images of a barcode.
 +
# Set the type of barcode you want to scan (EAN-13, UPC, Code 128, etc.)
 +
# Stop running the scan if a barcode is found.
 +
# Encode the image of the barcode into a UPC number, as a string in this case.
 +
# Let the user know that a barcode has been found with a notification.
 +
# Send the UPC to the API to find the item that is connected to the barcode.
 +
 +
For a more detailed description and code for the barcode, visit https://github.com/adelzell/GroceryGuru/blob/master/BarcodeScanner/BarcodeReaderViewController.swift. This contains the View Controller for the barcode scanner of our application.
  
 
[[Category:HowTos]]
 
[[Category:HowTos]]

Revision as of 18:51, 2 May 2017

Grocery Guru

Description

In order to scan a barcode in an application, you must use an AV Foundation to implement into your code.

Steps =

  1. Create a new View Controller in Xcode to have the barcode scanner on a separate page in the app.
  2. Import the AV Foundation at the top of your code so that you can use barcodes that are already provided instead of trying to individually code barcode images and UPC numbers.
  3. Create an object that captures low quality images of a barcode.
  4. Set the type of barcode you want to scan (EAN-13, UPC, Code 128, etc.)
  5. Stop running the scan if a barcode is found.
  6. Encode the image of the barcode into a UPC number, as a string in this case.
  7. Let the user know that a barcode has been found with a notification.
  8. Send the UPC to the API to find the item that is connected to the barcode.

For a more detailed description and code for the barcode, visit https://github.com/adelzell/GroceryGuru/blob/master/BarcodeScanner/BarcodeReaderViewController.swift. This contains the View Controller for the barcode scanner of our application.