All Projects → instacart → Nantes

instacart / Nantes

Licence: apache-2.0
Swift TTTAttributedLabel replacement

Programming Languages

swift
15916 projects

Projects that are alternatives of or similar to Nantes

Kdintroview
Stars: ✭ 300 (-64.79%)
Mutual labels:  swift-framework
Swiftinstagram
Instagram API client written in Swift
Stars: ✭ 570 (-33.1%)
Mutual labels:  swift-framework
Bluecap
iOS Bluetooth LE framework
Stars: ✭ 669 (-21.48%)
Mutual labels:  swift-framework
Steampress
A Blogging Engine and Platform written in Swift for use with the Vapor Framework
Stars: ✭ 337 (-60.45%)
Mutual labels:  swift-framework
Pulltodismiss
You can dismiss modal viewcontroller like Facebook Messenger by pulling scrollview or navigationbar in Swift.
Stars: ✭ 456 (-46.48%)
Mutual labels:  swift-framework
Awesome Swift
A curated list of awesome Swift frameworks, libraries and software.
Stars: ✭ 5,201 (+510.45%)
Mutual labels:  swift-framework
tapestry
Generate and maintain Swift frameworks with support for Cocoapods, Carthage and SPM
Stars: ✭ 64 (-92.49%)
Mutual labels:  swift-framework
Cheatyxml
CheatyXML is a Swift framework designed to manage XML easily
Stars: ✭ 23 (-97.3%)
Mutual labels:  swift-framework
Assistantkit
Easy way to detect iOS device properties, OS versions and work with screen sizes. Powered by Swift.
Stars: ✭ 569 (-33.22%)
Mutual labels:  swift-framework
Postal
A Swift framework for working with emails
Stars: ✭ 602 (-29.34%)
Mutual labels:  swift-framework
Xcglogger
A debug log framework for use in Swift projects. Allows you to log details to the console (and optionally a file), just like you would have with NSLog() or print(), but with additional information, such as the date, function name, filename and line number.
Stars: ✭ 3,710 (+335.45%)
Mutual labels:  swift-framework
Awesome Swift
A collaborative list of awesome Swift libraries and resources. Feel free to contribute!
Stars: ✭ 21,440 (+2416.43%)
Mutual labels:  swift-framework
Flightanimator
Advanced Natural Motion Animations, Simple Blocks Based Syntax
Stars: ✭ 588 (-30.99%)
Mutual labels:  swift-framework
Livecollections
Automatically perform UITableView and UICollectionView animations between two sets of immutable data. It supports generic data types and is fully thread-safe.
Stars: ✭ 337 (-60.45%)
Mutual labels:  swift-framework
Koyomi
Simple customizable calendar component in Swift 📆
Stars: ✭ 716 (-15.96%)
Mutual labels:  swift-framework
EKAstrologyCalc
Astrology Calculator calculates moon's rise/set times, moon Age, moon phases and Zodiac Sign for location and time
Stars: ✭ 31 (-96.36%)
Mutual labels:  swift-framework
Swiftybeaver
Convenient & secure logging during development & release in Swift 3, 4 & 5
Stars: ✭ 5,392 (+532.86%)
Mutual labels:  swift-framework
Taniwhatextfield
My first cocoapod framework
Stars: ✭ 26 (-96.95%)
Mutual labels:  swift-framework
Parade
Parallax Scroll-Jacking Effects Engine for iOS / tvOS
Stars: ✭ 754 (-11.5%)
Mutual labels:  swift-framework
Badgehub
A way to quickly add a notification badge icon to any view. Make any view of a full-fledged animated notification center.
Stars: ✭ 592 (-30.52%)
Mutual labels:  swift-framework

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!

Requirements

  • iOS 8.0+
  • Swift 4.2

Installation

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

github "instacart/nantes"

CocoaPods

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

pod 'Nantes'

Communication

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

Contributing

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.

Author

chansen22, [email protected]

Example

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: {
    self.view.layoutIfNeeded()
  })
}

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."
view.addSubview(label)

let linkLabel: NantesLabel = .init(frame: .zero)
linkLabel.delegate = self // NantesLabelDelegate
linkLabel.linkAttributes = [NSAttributedString.Key.foregroundColor: UIColor.green]
linkLabel.text = "https://www.instacart.com"
view.addSubview(linkLabel)

// Link handling

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


License

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

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].