TestsTested | ✓ |
LangLanguage | SwiftSwift |
License | MIT |
ReleasedLast Release | Nov 2016 |
SwiftSwift Version | 3.0 |
SPMSupports SPM | ✓ |
Maintained by Jesse Squires.
A default CustomStringConvertible
implementation for Swift types
Never implement var description: String
again. Simply import DefaultStringConvertible
and conform to CustomStringConvertible
and get a default type description for free.
This micro-library is based on this post from Erica Sadun.
Add DefaultStringConvertible as a dependency to your Package.swift
. For example:
let package = Package(
name: "YourPackageName",
dependencies: [
.Package(url: "https://github.com/jessesquires/DefaultStringConvertible.git", majorVersion: 2)
]
)
Read the docs. Generated with jazzy. Hosted by GitHub Pages.
$ ./build_docs.sh
$ open index.html -a Safari
import DefaultStringConvertible
class MyClass: CustomStringConvertible {
// ...
// You *do not* need to implement `var description: String`
// by importing `DefaultStringConvertible`, you get a default `description` for free
}
There’s a suite of unit tests for DefaultStringConvertible
. Run them from Xcode by opening DefaultStringConvertible.xcodeproj
.
Please follow these sweet contribution guidelines.
Created and maintained by @jesse_squires.
DefaultStringConvertible
is released under an MIT License. See LICENSE
for details.
Copyright © 2016-present Jesse Squires.
Please provide attribution, it is greatly appreciated.