Swiftpack.co - alexandreos/UILabel-Copyable as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by alexandreos.
alexandreos/UILabel-Copyable 2.0.1
A simple category to add copy functionality to UILabel.
⭐️ 120
🕓 3 years ago
iOS
.package(url: "https://github.com/alexandreos/UILabel-Copyable.git", from: "2.0.1")

UILabel+Copyable Supported Platforms Latest pod release Build Status codecov.io

A simple UILabel category meant to add copy functionality to it.

Features

  • Supports Interface Builder
  • Supports long press gesture
  • Allows enable/disable the copy feature
  • Works with all UILabel objects already in your project

Installation

CocoaPods

UILabel+Copyable is available via CocoaPods.

pod 'UILabel+Copyable', '~> 2.0'

Swift Package Manager

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 Package.swift:

dependencies: [
    .package(url: "https://github.com/alexandreos/UILabel-Copyable.git", .upToNextMajor(from: "2.0"))
]

Old-fashioned way

  • Add UILabel+Copyable.swift to your project.

Usage

Just import the module: import UILabel_Copyable and then set the isCopyingEnabled property to true:

Swift:

let label = UILabel(frame: CGRect(x: 0, y: 0, width: 100, height: 30))
label.isCopyingEnabled = true
view.addSubview(label)

Objective-C:

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:

Swift:

import UILabel_Copyable

@IBOutlet weak var label: UILabel?

// ...
label?.isCopyingEnabled = true

There is a demo project included in the Demo folder, which shows how to use it from a storyboard.

UILabel+Copyable

Change log

Please see CHANGELOG

License

UILabel+Copyable is licensed under the terms of the MIT License. Please see the LICENSE file for full details.

GitHub

link
Stars: 120
Last commit: 2 years ago
Advertisement: IndiePitcher.com - Cold Email Software for Startups

Release Notes

Swift Package Manager Support
3 years ago

Added SPM support 🎉

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics