SwiftyAttributes
A Swifty API for attributed strings.
With SwiftyAttributes, you can create attributed strings like so:
Alternatively, use the Attribute
enum:
You can also easily combine attributed strings using a plus sign:
SwiftyAttributes has support for every attribute available in Cocoa and Cocoa Touch.
Requirements
- iOS 8.0+, macOS 10.11+, watchOS 2.0+, tvOS 9.0+
- Swift 4.2+
- Xcode 10.0+
Installation
With CocoaPods
pod 'SwiftyAttributes'
With Carthage
github "eddiekaiger/SwiftyAttributes"
Usage
Initializing attributed strings in SwiftyAttributes
can be done several ways:
-
Using the
with[Attribute]
extensions: -
Using the
Attribute
enum extensions: -
Using the
Attribute
enum in an initializer:
You can retrieve the attribute at a specific location using the built-in NSAttributedString.Key
enum:
Several API methods are provided to use these new enums as well as Swift's Range
type instead of NSRange
. Some of the method signatures include:
Support
For questions, support, and suggestions, please open up an issue.
License
SwiftyAttributes is available under the MIT license. See the LICENSE file for more info.