Swiftpack.co -  koznobikhin/OzStringKit as Swift Package
Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
koznobikhin/OzStringKit
NSAttributedString creation with Swift 5 string interpolation.
.package(url: "https://github.com/koznobikhin/OzStringKit.git", from: "0.0.8")

OzStringKit

Travis (.com) GitHub tag (latest SemVer) Accio supported Swift Package Manager compatible Cocoapods Platforms License

NSAttributedString creation with Swift 5 string interpolation

Example

let swiftLogo = UIImage(named: "SwiftLogo")!
let url = URL(string: "https://swift.org/")!

let attributedText = attributedString("""
    \("Some colorful text:", .underline(.single, color: .red))
    \("red", .color(.red)), \("orange", .color(.orange)), \("yellow", .color(.yellow)), \
    \("green", .color(.green)), \("blue", .color(.blue))

    \(image: swiftLogo) an image and an \("url", .link(url))
    """)

let shadow = NSShadow()
shadow.shadowColor = UIColor.black.withAlphaComponent(0.3)
shadow.shadowBlurRadius = 4.0
shadow.shadowOffset = CGSize(width: 0.0, height: 2.0)
self.label.attributedText = attributedString("\(attributedText, .alignment(.center), .shadow(shadow))")

Screen shot

Installation

Swift Package Manager

Add this to your project using Swift Package Manager. In Xcode that is simply: File > Swift Packages > Add Package Dependency... and you're done.

dependencies: [
    .package(url: "https://github.com/koznobikhin/OzStringKit.git", .upToNextMajor(from: "0.0.8"))
]

Accio

Accio is a dependency manager based on SwiftPM which can build frameworks for iOS/macOS/tvOS/watchOS. Therefore the integration steps of OzStringKit are exactly the same as described above. Once your Package.swift file is configured, run accio update instead of swift package update.

CocoaPods

If you are already using CocoaPods, just add 'OzStringKit' to your Podfile then run pod install. For more detailed usage and installation instructions, visit their website.

pod 'OzStringKit'

Author

Konstantin Oznobikhin

License

OzStringKit is available under the MIT license. See the LICENSE file for more information.

GitHub

link
Stars: 0
Last commit: 3 weeks ago

Ad: Job Offers

iOS Software Engineer @ Perry Street Software
Perry Street Software is Jack’d and SCRUFF. We are two of the world’s largest gay, bi, trans and queer social dating apps on iOS and Android. Our brands reach more than 20 million members worldwide so members can connect, meet and express themselves on a platform that prioritizes privacy and security. We invest heavily into SwiftUI and using Swift Packages to modularize the codebase.

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