Skip to content
Swift TTTAttributedLabel replacement
Branch: master
Clone or download
Type Name Latest commit message Commit time
Failed to load latest commit information.
Example Bump to version 0.0.6 Mar 5, 2019
Nantes Fix issue where setting attributedText could override properties (#10) Mar 5, 2019
Source Stop touches being passed to other views if we handle them (#12) Mar 14, 2019
fastlane [platform] Use SPM to lock swiftlint version (#7) Feb 27, 2019
.gitignore [platform] Use SPM to lock swiftlint version (#7) Feb 27, 2019
.swiftlint.yml [platform] Use SPM to lock swiftlint version (#7) Feb 27, 2019
Gemfile [platform] Use SPM to lock swiftlint version (#7) Feb 27, 2019
LICENSE Update License Feb 8, 2019
Package.resolved [platform] Use SPM to lock swiftlint version (#7) Feb 27, 2019
Package.swift Fix capitalization for URL for travis status Feb 27, 2019

Nantes 🥕

CI Status CocoaPods Compatible Carthage Compatible

This library is a Swift port/fork of the popular Objective-C library TTTAttributedLabel. Much ❤️ and credit goes to Mattt for creating such a great UILabel replacement library.

Nantes is a pure-Swift UILabel replacement. It supports attributes, data detectors, and more. It also supports link embedding automatically and with NSTextCheckingTypes.

Come build awesome things with us here at Instacart!


  • iOS 8.0+
  • Swift 4.2


Nantes is available through Carthage. To install it, add the following line to your Cartfile:

github "instacart/nantes"


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

pod 'Nantes'


If you need help, feel free to open an issue. Please search before opening one, someone might have run into something similar.


Opening a pull request is the best way to get something fixed. If you need help, feel free to open an issue, hopefully someone can help you out with a problem you're running into.




To run the example project, clone the repo, and run pod install from the Example directory first.

Getting Started

Check out Nantes in the Example directory for more examples.

import Nantes

let label: NantesLabel = .init(frame: .zero)
label.attributedTruncationToken = NSAttributedString(string: "... more")
label.numberOfLines = 3
label.labelTappedBlock = {
  label.numberOfLines = label.numberOfLines == 0 ? 3 : 0 // Flip between limiting lines and not

  UIView.animateWithDuration(0.2, animations: {

label.text = "Nantes label is great! Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus ac urna et ante lobortis varius. Nunc rhoncus enim vitae sem commodo sodales. Morbi id augue id augue finibus tincidunt. Cras ac massa nisi. Maecenas elementum vitae elit eu mattis. Duis pretium turpis ut justo accumsan molestie. Mauris elit elit, maximus eu risus sed, vestibulum sodales enim. Sed porttitor vestibulum tincidunt. Maecenas mollis tortor quam, sed porta justo rhoncus id. Phasellus vitae augue tempor, luctus metus sit amet, dictum urna. Morbi sit amet feugiat purus. Proin vitae finibus lectus, eu gravida erat."

let linkLabel: NantesLabel = .init(frame: .zero)
linkLabel.delegate = self // NantesLabelDelegate
linkLabel.linkAttributes = [NSAttributedString.Key.foregroundColor:]
linkLabel.text = ""

// Link handling

func attributedLabel(_ label: NantesLabel, didSelectLink link: URL) {
  print("Tapped link: \(link)")


Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
See the License for the specific language governing permissions and
limitations under the License.
You can’t perform that action at this time.