diff --git a/Yep/Views/Cells/FeedSocialWork/FeedSocialWorkCell.swift b/Yep/Views/Cells/FeedSocialWork/FeedSocialWorkCell.swift index 55c198de..dbe2b087 100644 --- a/Yep/Views/Cells/FeedSocialWork/FeedSocialWorkCell.swift +++ b/Yep/Views/Cells/FeedSocialWork/FeedSocialWorkCell.swift @@ -336,30 +336,6 @@ class FeedSocialWorkCell: FeedBasicCell { self?.locationMapImageView.image = image }) - /* - let options = MKMapSnapshotOptions() - options.scale = UIScreen.mainScreen().scale - let size = CGSize(width: UIScreen.mainScreen().bounds.width - 65 - 60, height: 110 - locationNameLabel.bounds.height) - options.size = size - options.region = MKCoordinateRegionMakeWithDistance(locationCoordinate, 500, 500) - - let mapSnapshotter = MKMapSnapshotter(options: options) - - mapSnapshotter.startWithCompletionHandler { (snapshot, error) -> Void in - if error == nil { - - guard let snapshot = snapshot else { - return - } - - let image = snapshot.image - - dispatch_async(dispatch_get_main_queue()) { [weak self] in - self?.locationMapImageView.image = image - } - } - }*/ - locationNameLabel.text = locationInfo.name } } diff --git a/Yep/Views/Feed/FeedView.swift b/Yep/Views/Feed/FeedView.swift index 0f0080b8..51072e87 100644 --- a/Yep/Views/Feed/FeedView.swift +++ b/Yep/Views/Feed/FeedView.swift @@ -421,28 +421,10 @@ class FeedView: UIView { if let locationCoordinate = feed.locationCoordinate { - let options = MKMapSnapshotOptions() - options.scale = UIScreen.mainScreen().scale let size = CGSize(width: UIScreen.mainScreen().bounds.width - 65 - 60, height: 80 - locationNameLabel.bounds.height) - options.size = size - options.region = MKCoordinateRegionMakeWithDistance(locationCoordinate, 500, 500) - - let mapSnapshotter = MKMapSnapshotter(options: options) - - mapSnapshotter.startWithCompletionHandler { (snapshot, error) -> Void in - if error == nil { - - guard let snapshot = snapshot else { - return - } - - let image = snapshot.image - - dispatch_async(dispatch_get_main_queue()) { [weak self] in - self?.locationMapImageView.image = image - } - } - } + ImageCache.sharedInstance.mapImageOfLocationCoordinate(locationCoordinate, withSize: size, completion: { [weak self] image in + self?.locationMapImageView.image = image + }) } locationNameLabel.text = feed.locationName