Skip to content

gabrielPeart/DefaultStringConvertible

 
 

Repository files navigation

DefaultStringConvertible

Build Status Version Status license MIT codecov Platform Carthage compatible

A default CustomStringConvertible implementation for Swift types

About

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.

Requirements

  • Xcode 7.3+
  • iOS 8.0+
  • OSX 10.10+
  • tvOS 9.0+
  • watchOS 2.0+
  • Swift 2.2+

Installation

CocoaPods (recommended)

use_frameworks!

# For latest release in cocoapods
pod 'DefaultStringConvertible'

# Feeling adventurous? Get the latest on develop
pod 'DefaultStringConvertible', :git => 'https://github.com/jessesquires/DefaultStringConvertible.git', :branch => 'develop'
github "jessesquires/DefaultStringConvertible"

Documentation

Read the docs. Generated with jazzy. Hosted by GitHub Pages. More information on the gh-pages branch.

Getting Started

import DefaultStringConvertible

class MyClass: CustomStringConvertible {
    // ...
    
    // You *do not* need to implement `var description: String`
    // by importing `DefaultStringConvertible`, you get a default `description` for free
}

Unit tests

There's a suite of unit tests for DefaultStringConvertible. Run them from Xcode by opening DefaultStringConvertible.xcodeproj. These tests are well commented and serve as further documentation for how to use this library.

Contribute

Please follow these sweet contribution guidelines.

Credits

Created and maintained by @jesse_squires.

License

DefaultStringConvertible is released under an MIT License. See LICENSE for details.

Copyright © 2016-present Jesse Squires.

Please provide attribution, it is greatly appreciated.

About

A default CustomStringConvertible implementation for Swift types

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Swift 90.8%
  • Ruby 5.4%
  • Objective-C 3.8%