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
//STEP 1: - GET ROUTES | |
func getRoute(coordinates: [CLLocationCoordinate2D]) { | |
googleMapsNetworkAgent.getRouteFromGoogleMaps(coordinates: coordinates) | |
.subscribeOn(MainScheduler.instance) | |
.subscribe(onNext: { [weak self] response in | |
guard let this = self else {return} | |
if let status = response.status, status == "OK" { | |
let overviewPolyline = response.routes?.first?.overviewPolyline?.points | |
//STEP 2: - DRAW A ROUTE ON THE MAP | |
this.drawRouteOnMap(route: overviewPolyline) |
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
notificationFeedbackGenerator = nil | |
impactFeedbackGenerator = nil | |
selectionFeedbackGenerator = 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
notificationFeedbackGenerator.prepare() | |
//or | |
impactFeedbackGenerator.prepare() | |
//or | |
selectionFeedbackGenerator.prepare() |
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
private let selectionFeedbackGenerator = UISelectionFeedbackGenerator() | |
selectionFeedbackGenerator.selectionChanged() |
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
private let notificationFeedbackGenerator = UIImpactFeedbackGenerator(style: .light) | |
//or | |
private let notificationFeedbackGenerator = UIImpactFeedbackGenerator(style: .medium) | |
//or | |
private let notificationFeedbackGenerator = UIImpactFeedbackGenerator(style: .heavy) | |
//or | |
private let notificationFeedbackGenerator = UIImpactFeedbackGenerator(style: .rigid) | |
//or | |
private let notificationFeedbackGenerator = UIImpactFeedbackGenerator(style: .soft) |
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
private let notificationFeedbackGenerator = UINotificationFeedbackGenerator() | |
notificationFeedbackGenerator.notificationOccurred(.error) | |
//or | |
notificationFeedbackGenerator.notificationOccurred(.success) | |
//or | |
notificationFeedbackGenerator.notificationOccurred(.warning) |
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
import UIKit | |
import LinkPresentation | |
class ViewController: UIViewController { | |
@IBOutlet weak var sharingButton: UIButton! | |
private var metaData: LPLinkMetadata = LPLinkMetadata() { | |
didSet { | |
DispatchQueue.main.async { |
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
func getMetadataForSharingManually(title: String, url: URL, fileName: String, fileType: String) -> LPLinkMetadata { | |
let linkMetaData = LPLinkMetadata() | |
let path = Bundle.main.path(forResource: fileName, ofType: fileType) | |
linkMetaData.iconProvider = NSItemProvider(contentsOf: URL(fileURLWithPath: path ?? "")) | |
linkMetaData.originalURL = url | |
linkMetaData.title = title | |
return linkMetaData | |
} |
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
class LinkPresentationItemSource: NSObject, UIActivityItemSource { | |
var linkMetaData = LPLinkMetadata() | |
//Prepare data to share | |
func activityViewControllerLinkMetadata(_ activityViewController: UIActivityViewController) -> LPLinkMetadata? { | |
return linkMetaData | |
} | |
//Placeholder for real data, we don't care in this example so just return a simple string | |
func activityViewControllerPlaceholderItem(_ activityViewController: UIActivityViewController) -> Any { |