Latest 4.2.0
License MIT
Platforms ios 9.0, requires ARC

UILabel extension to enable copying



import CopyableLabel

let label = UILabel()
label.copyable = true

Or set copyable property to true in Interface Builder.

If another object (e.g. UIViewController) has a need to know which CopyableLabel has invoked the UIMenuController (i.e. presented the ‘Copy’ balloon, register the object for CopyableLabel.didShowCopyMenuNotification notification:

NotificationCenter.default.addObserver(self, selector: #selector(receivedCopyableLabelNotification(_:)), name: CopyableLabel.didShowCopyMenuNotification, object: nil)

The registering object will receive a Notification that contains a reference to the CopyableLabel that posted the notification.

@objc func receivedCopyableLabelNotification(_ notification: NSNotification) {
    if let label = notification.object as? UILabel {

UIMenuController does post a UIMenuController.didShowMenuNotification, however that notification does not provide any additional information (i.e. which UI elemement posted the notification, where the menu is, etc.).

Register for the UIMenuController willHide or didHide notifications, if you need to know when the menu is dismissed.


iOS 9 or higher



CopyableLabel is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod "CopyableLabel"


You can use Carthage to install CopyableLabel by adding it to your Cartfile:

github "dostu/CopyableLabel"


Donatas Stundys, [email protected]


CopyableLabel is available under the MIT license. See the LICENSE file for more info.

Latest podspec

    "name": "CopyableLabel",
    "version": "4.2.0",
    "summary": "UILabel extension to enable copying",
    "description": "Copying can be enabled by setting copyable property of UILabel either in Interface Builder ornprogramatically.",
    "homepage": "",
    "screenshots": "",
    "license": "MIT",
    "authors": {
        "Donatas Stundys": "[email protected]"
    "source": {
        "git": "",
        "tag": "4.2.0"
    "platforms": {
        "ios": "9.0"
    "requires_arc": true,
    "source_files": "Source/*.swift"

Pin It on Pinterest

Share This