UIActivity subclass for copying link URL to pasteboard
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
Assets/Image.xcassets
CopyLinkActivity.xcodeproj
Example
Sources/CopyLinkActivity
Tests/CopyLinkActivityTests
.gitignore
.ruby-version
CopyLinkActivity.podspec
README.md

README.md

CopyLinkActivity

Swift version CocoaPods compatible Carthage compatible

UIActivity subclass for copying link URL to pasteboard

Usage

Example

import UIKit
import CopyLinkActivity

class ViewController: UIViewController {
    @IBAction func didTapShareButton(_ sender: UIButton) {
        let linkURL = URL(string: "https://www.apple.com/")!
        let activityViewController = UIActivityViewController(activityItems: [linkURL], applicationActivities: [CopyLinkActivity()])
        activityViewController.completionWithItemsHandler = { [weak self] (activityType, completed, _, _) -> Void in
            if completed && activityType == CopyLinkActivity.defaultActivityType {
                let alert = UIAlertController(title: "Copied", message: linkURL.absoluteString, preferredStyle: .alert)
                alert.addAction(UIAlertAction(title: "OK", style: .default, handler: nil))
                self?.present(alert, animated: true)
            }
        }
        present(activityViewController, animated: true)
    }
}

Installation

Carthage

Cartfile

github "morishin/CopyLinkActivity"

CocoaPods

Podfile

pod 'CopyLinkActivity'

LICENSE

MIT