Last active
February 4, 2020 03:06
-
-
Save ryanisnhp/59db39d4c547e499e70b448b40b7dc50 to your computer and use it in GitHub Desktop.
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 { | |
return "Placeholder" | |
} | |
/// Return the data will be shared | |
/// - Parameters: | |
/// - activityType: Ex: mail, message, airdrop, etc.. | |
func activityViewController(_ activityViewController: UIActivityViewController, itemForActivityType activityType: UIActivity.ActivityType?) -> Any? { | |
return linkMetaData.originalURL | |
} | |
init(metaData: LPLinkMetadata) { | |
self.linkMetaData = metaData | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment