This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| let backgroundQueue : dispatch_queue_t = dispatch_queue_create("com.aGupieWare.SwiftNetworking.backgroundQueue", nil) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // endpoint of corresponding supply item image // | |
| let urlString : String = supplyItem.bsn_image! | |
| dispatch_async(self.backgroundQueue, { () -> Void in | |
| /* capture the index of the cell that is requesting this image download operation */ | |
| var err : NSError? | |
| /* get url for image and download raw data */ | |
| if err == nil { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var capturedIndex : NSIndexPath? = indexPath.copy() as? NSIndexPath |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| let url = NSURL(string: urlString)! | |
| var imageData : NSData? = NSData(contentsOfURL: url, options: NSDataReadingOptions.DataReadingMappedIfSafe, error: &err) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| let itemImage = UIImage(data:imageData!) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| let currentIndex = tableView.indexPathForCell(cell) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| currentIndex?.item == capturedIndex!.item |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @IBOutlet weak var bsn_imageView: UIImageView! | |
| @IBOutlet weak var bsn_textView: UITextView! | |
| var bsn_plumbingItem: PlumbingSupplyItem? | |
| var bsn_capturedImage: UIImage? | |
| var urlSession = NSURLSession.sharedSession() | |
| let backgroundQueue : dispatch_queue_t = dispatch_queue_create("com.aGupieWare.SwiftNetworking.backgroundQueue", nil) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| let destViewController = segue.destinationViewController as PlumbingSupplyItemDescriptionViewController | |
| let selectedCell = sender as UITableViewCell | |
| let selectedIndex = self.tableView.indexPathForCell(selectedCell) | |
| destViewController.bsn_plumbingItem = self.dataSource[selectedIndex!.row] | |
| destViewController.bsn_capturedImage = selectedCell.imageView.image |