Closed MichealSBingham closed 7 years ago
scanner.prepareScan(self.view){ (swapLink) in
self.nameLabel.isHidden = true
self.bioLabel.isHidden = true
self.verifiedIcon.isHidden = true
self.profilePic.isHidden = true
self.animateInSwapView()
self.loadingSymbol = loadingOverlay.showLoadingSymbol(view: self.view, shouldCenter: true)
self.view.addSubview(self.loadingSymbol!)
/// .......... continue other stuff
SwapUser().swap(with: username, authorizeOnViewController: self, completion: { (error, user) in
DispatchQueue.main.async {
self.loadingSymbol?.isHidden = true
/// ... .. continue other stuff
// add this too
func showLoadingSymbol(view: UIView, shouldCenter: Bool = false) -> UIImageView {
let image = UIImage(named: "LoadingSymbol")
let loadingSymbol = UIImageView(image: image!)
// loadingSymbol.frame = CGRect(x: 171, y: 318, width: 35, height: 35)
if shouldCenter{
loadingSymbol.center = (view.superview?.center)!
} else {
loadingSymbol.frame = CGRect(x: view.frame.size.width/2-20, y: view.frame.size.height/2, width: 35, height: 35)
}
Show some type of loading indicator while scanner is scanning.
// DELETE THIS LINE OF CODE WHEN THERE IS AN ERROR scanner.startScan()