Latest 0.1
Homepage https://github.com/lukaswuerzburger/table-print
License MIT
Platforms ios 9.0, requires ARC

TablePrint is a tool designed for developers. It prints tables of dictionaries in the debugger console.

Contents

✍️ Description

TablePrint simply comes with only one function that takes a dictionary:

func printTable(_ content: [AnyHashable : Any?])

🖥 Examples

1. Book Details

You can throw in a dictionary with anything in it.

let book: [AnyHashable : Any?] = [
    "title": "The iPhone Developer's Cookbook",
    "author": "Erica Sadun",
    "publish_date": Date(timeIntervalSince1970: 1261094400),
    "price": 16.65
]
printTable(book)
+--------------+---------------------------------+
| Key          | Value                           |
+--------------+---------------------------------+
| publish_date | 2009-12-18 00:00:00 +0000       |
| author       | Erica Sadun                     |
| title        | The iPhone Developer's Cookbook |
| price        | 16.65                           |
+--------------+---------------------------------+

2. String Attributes

let stringAttributes: [NSAttributedStringKey : Any?] = [
    .foregroundColor : UIColor.red,
    .kern : 1,
    .link: URL(string: "https://apple.com/"),
]
printTable(stringAttributes)
+---------+----------------------------------+
| Key     | Value                            |
+---------+----------------------------------+
| NSLink  | https://apple.com/               |
| NSColor | UIExtendedSRGBColorSpace 1 0 0 1 |
| NSKern  | 1                                |
+---------+----------------------------------+

💻 How to use

TablePrint is available on Cocoapods. Just put following line in your Podfile:

pod 'TablePrint'

⚠️ Requirements

  • Swift 4+
  • iOS 9+
  • macOS 10.10+
  • Xcode 9+

🐞 Known Issues

  • #2 The column width is currently not limited. Long lines result in ugly line breaks that break the whole UI of the table.
  • #1 Can’t run on macOS command line tool.

💪 Contribute

Issues and pull requests are welcome.

Latest podspec

{
    "name": "TablePrint",
    "version": "0.1",
    "summary": "TablePrint is a tool designed for developers. It prints tables of dictionaries in the debugger console.",
    "authors": "Lukas Wu00fcrzburger",
    "license": {
        "type": "MIT"
    },
    "homepage": "https://github.com/lukaswuerzburger/table-print",
    "platforms": {
        "ios": "9.0"
    },
    "source": {
        "git": "https://github.com/lukaswuerzburger/table-print.git",
        "tag": "0.1"
    },
    "source_files": "table-print/Sources/*.swift",
    "ios": {
        "frameworks": "Foundation"
    },
    "requires_arc": true
}

Pin It on Pinterest

Share This