A simple UILabel category meant to add copy functionality to it.
UILabel+Copyable is available via CocoaPods.
pod 'UILabel+Copyable', '~> 2.0'
The Swift Package Manager is also supported
Once you have your Swift package set up, adding UILabel+Copyable as a dependency is as easy as adding it to the
dependencies value of your
dependencies: [ .package(url: "https://github.com/alexandreos/UILabel-Copyable.git", .upToNextMajor(from: "2.0")) ]
UILabel+Copyable.swiftto your project.
Just import the module:
import UILabel_Copyable and then set the
isCopyingEnabled property to
let label = UILabel(frame: CGRect(x: 0, y: 0, width: 100, height: 30)) label.isCopyingEnabled = true view.addSubview(label)
UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 100, 30)]; label.isCopyingEnabled = YES; [self.view addSubview:label];
The same thing can be done with IBOutlet UILabel:
import UILabel_Copyable @IBOutlet weak var label: UILabel? // ... label?.isCopyingEnabled = true
Included is a demo project showing how to use it from a storyboard.
Please see CHANGELOG
UILabel+Copyable is licensed under the terms of the MIT License. Please see the LICENSE file for full details.
|Last commit: 3 weeks ago|
Added SPM support 🎉