 	var adjustQuantity:Int = 0
 	var tableView:UITableView!
 
+	// Some buttons we will reuse.
+	var deleteButton:MGSwipeButton? = nil
+	var openURLButton:MGSwipeButton? = nil
+
 	override func viewDidLoad() {
 		super.viewDidLoad()
 		// Do any additional setup after loading the view, typically from a nib.

		tableView = self.view.subviews.first as! UITableView
		tableView.delegate = self
		tableView.dataSource = self

		flycut.awake(fromNibDisplaying: 10, withDisplayLength: 140, withSave: #selector(savePreferences(toDict:)), forTarget: self) // The 10 isn't used in iOS right now and 140 characters seems to be enough to cover the width of the largest screen.


	}

	func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
		let item: MGSwipeTableCell = tableView.dequeueReusableCell(withIdentifier: "FlycutCell", for: indexPath) as! MGSwipeTableCell

		item.textLabel?.text = flycut.previousDisplayStrings(indexPath.row + 1, containing: nil).last as! String?
		let content = flycut.clippingString(withCount: Int32(indexPath.row) )

		//configure left buttons
		if URL(string: content!) != nil {
			if (content?.lowercased().hasPrefix("http"))! {
				if(!item.leftButtons.contains(openURLButton!))
				{
					item.leftButtons.append(openURLButton!)
					item.leftSwipeSettings.transition = .border
					item.leftExpansion.buttonIndex=0
				}
			}
			else {
				item.leftButtons.removeAll()
			}
		}
		else {
			item.leftButtons.removeAll()
		}

		//configure right buttons
		if ( 0 == item.rightButtons.count )
		{
			// Setup the right buttons only if they haven't been before.
			item.rightButtons.append(deleteButton!)
			item.rightSwipeSettings.transition = .border
			item.rightExpansion.buttonIndex = 0
		}

		return item
	}
