Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/morishin/copylinkactivity

UIActivity subclass for copying link URL to pasteboard
https://github.com/morishin/copylinkactivity

ios swift

Last synced: 23 days ago
JSON representation

UIActivity subclass for copying link URL to pasteboard

Awesome Lists containing this project

README

        

# CopyLinkActivity

![Swift version](https://img.shields.io/badge/swift-4.0-orange.svg)
![CocoaPods compatible](https://cocoapod-badges.herokuapp.com/v/CopyLinkActivity/badge.png)
[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)

UIActivity subclass for copying link URL to pasteboard

## Usage
[Example](https://github.com/morishin/CopyLinkActivity/tree/master/Example)
```swift
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

```ruby
pod 'CopyLinkActivity'
```

## LICENSE
MIT