SwiftyTextTable alternatives and similar libraries
Based on the "Logging" category.
Alternatively, view SwiftyTextTable alternatives based on common mentions on social networks and blogs.
-
CocoaLumberjack
A fast & simple, yet powerful & flexible logging framework for macOS, iOS, tvOS and watchOS -
SwiftyBeaver
Convenient & secure logging during development & release in Swift 4 & 5 -
XCGLogger
A debug log framework for use in Swift projects. Allows you to log details to the console (and optionally a file), just like you would have with NSLog() or print(), but with additional information, such as the date, function name, filename and line number. -
GodEye
Automaticly display Log,Crash,Network,ANR,Leak,CPU,RAM,FPS,NetFlow,Folder and etc with one line of code based on Swift. Just like God opened his eyes -
TinyConsole
๐ฑ๐ฌ๐ฆ TinyConsole is a micro-console that can help you log and display information inside an iOS application, where having a connection to a development computer is not possible. -
Watchdog
Class for logging excessive blocking on the main thread -
CleanroomLogger
CleanroomLogger provides an extensible Swift-based logging API that is simple, lightweight and performant -
Willow
Willow is a powerful, yet lightweight logging library written in Swift. -
KZLinkedConsole
Clickable links in your Xcode console, so you never wonder which class logged the message. -
QorumLogs
:closed_book: Swift Logging Utility for Xcode & Google Docs -
AFNetworkActivityLogger
AFNetworking 3.0 Extension for Network Request Logging -
Diagnostics
Allow users to easily share Diagnostics with your support team to improve the flow of fixing bugs. -
JustLog
JustLog brings logging on iOS to the next level. It supports console, file and remote Logstash logging via TCP socket with no effort. Support for logz.io available. -
Gedatsu
Gedatsu provide readable format about AutoLayout error console log -
LxDBAnything
Automate box any value! Print log without any format control symbol! Change debug habit thoroughly! -
XLFacility
Elegant and extensive logging facility for OS X & iOS (includes database, Telnet and HTTP servers) -
Twitter Logging Service
Twitter Logging Service is a robust and performant logging framework for iOS clients -
Aardvark
Aardvark is a library that makes it dead simple to create actionable bug reports. -
Loggerithm
A lightweight Swift logger, uses print in development and NSLog in production. Support colourful and formatted output. -
BlockTypeDescription
Show type signatures when logging blocks -
puree
[Obsoleted] A log collector for iOS (new version! -> https://github.com/cookpad/Puree-Swift) -
Logkit
An efficient logging library for OS X, iOS, watchOS, and tvOS โ written in Swift. Log to console, file, HTTP service, or your own endpoint. Simple to get started, but smartly customizable. -
Atlantis
A powerful input-agnostic swift logging framework made to speed up development with maximum readability. -
AEConsole
Customizable Console UI overlay with debug log on top of your iOS App -
Bugfender
Bugfender SDK for iOS, a remote logger tailor-made for mobile -
CleanroomASL
A Swift-based API for reading from & writing to the Apple System Log (more commonly known somewhat inaccurately as "the console") -
TraceLog
TraceLog is a highly configurable, flexible, portable, and simple to use debug logging system for Swift and Objective-C applications running on Linux, macOS, iOS, watchOS, and tvOS. -
ReflectedStringConvertible
A protocol that allows any class to be printed as if it were a struct or a JSON object. -
XLTestLog
Styling and coloring your XCTest logs on Xcode Console -
Lighty
Easy to use and lightweight logger for iOS, macOS, tvOS, watchOS and Linux in Swift. -
AELog
Simple, lightweight and flexible debug logging framework written in Swift -
Spy
Spy is a flexible, lightweight, multiplatform logging utility written in pure Swift. It allows to log with different levels and on different channels. You can define what levels and channels actually are. -
StoryTeller
A log should tell a story, not drown the reader in irrelevance.
Appwrite - The open-source backend cloud platform
* Code Quality Rankings and insights are calculated and provided by Lumnify.
They vary from L1 to L5 with "L5" being the highest.
Do you think we are missing an alternative of SwiftyTextTable or a related project?
README
SwiftyTextTable
A lightweight Swift library for generating text tables.
Swift Language Support
SwiftyTextTable is now Swift 4.0 compatible! The last release to support Swift 3.1 was 0.7.1. The last release to support Swift 2.3 was 0.3.1.
Installation
Carthage (OS X)
You can use Carthage to install
SwiftyTextTable by adding it to your Cartfile
:
github "scottrhoyt/SwiftyTextTable"
Swift Package Manager (OS X + Linux)
You can use The Swift Package Manager to
install SwiftyTextTable by adding the proper description to your
Package.swift
file:
import PackageDescription
let package = Package(
name: "<YOUR_PROJECT_NAME>",
dependencies: [
.package(url: "https://github.com/scottrhoyt/SwiftyTextTable.git", from: "0.5.0")
]
)
CocoaPods (OS X)
You can use CocoaPods to install SwiftyTextTable by
adding it to your Podfile
:
pod 'SwiftyTextTable'
Manual
Simply copy the *.swift
files from the Source/SwiftyTextTable
directory into
your project.
Usage
import SwiftyTextTable
// First create some columns
let foo = TextTableColumn(header: "foo")
let bar = TextTableColumn(header: "bar")
let baz = TextTableColumn(header: "baz")
// Then create a table with the columns
var table = TextTable(columns: [foo, bar, baz])
// Then add some rows
table.addRow([1, 2, 3])
table.addRow([11, 22, 33])
// Then render the table and use
let tableString = table.render()
print(tableString)
/*
+-----+-----+-----+
| foo | bar | baz |
+-----+-----+-----+
| 1 | 2 | 3 |
| 11 | 22 | 33 |
+-----+-----+-----+
*/
// Put a header on the table if you'd like
table.header = "my foo table"
print(table.render())
/*
+-----------------+
| my foo table |
+-----------------+
| foo | bar | baz |
+-----+-----+-----+
| 1 | 2 | 3 |
| 11 | 22 | 33 |
+-----+-----+-----+
*/
Any CustomStringConvertible
can be used for row values
.
Creating Tables from Arrays of Objects with TextTableRepresentable
Let's say you have an array of objects that looks this:
enum AnimalType: String, CustomStringConvertible {
case dog = "Dog"
case cat = "Cat"
case gorilla = "Gorilla"
var description: String {
return self.rawValue
}
}
struct Pet {
let type: AnimalType
let name: String
let canHazPizza: Bool
}
let furball = Pet(type: .cat, name: "Furball", canHazPizza: false)
let bestFriend = Pet(type: .dog, name: "Best Friend", canHazPizza: true)
let scary = Pet(type: .gorilla, name: "Scary", canHazPizza: true)
let pets = [furball, bestFriend, scary]
Now you want to print a table containing your pets
. You can accomplish this
by having Pet
conform to TextTableRepresentable
:
extension Pet: TextTableRepresentable {
static var columnHeaders: [String] {
return ["Name", "Animal", "Can Haz Pizza?"]
}
var tableValues: [CustomStringConvertible] {
return [name, type, canHazPizza ? "yes" : "no"]
}
// Optional
static var tableHeader: String? {
return "My Pets"
}
}
You can now print a table of your pets
simply:
print(pets.renderTextTable())
/*
+----------------------------------------+
| My Pets |
+----------------------------------------+
| Name | Animal | Can Haz Pizza? |
+-------------+---------+----------------+
| Furball | Cat | no |
| Best Friend | Dog | yes |
| Scary | Gorilla | yes |
+-------------+---------+----------------+
*/
Fence Custimization
You can also customize the output of TextTable.render()
by using different
values for columnFence
, rowFence
, and cornerFence
.
table.columnFence = ":"
table.rowFence = "."
table.cornerFence = "."
print(table.render())
/*
...................
: foo : bar : baz :
...................
: 1 : 2 : :
: 11 : 22 : 33 :
...................
*/
Row Padding/Truncation
When adding rows, TextTable
will automatically pad the rows with empty strings
when there are fewer values
than columns. TextTable
will also disregard all
values
over the column count.
let foo = TextTableColumn(header: "foo")
let bar = TextTableColumn(header: "bar")
let baz = TextTableColumn(header: "baz")
var table = TextTable(columns: [foo, bar, baz])
table.addRow([1, 2])
table.addRow([11, 22, 33])
table.addRow([111, 222, 333, 444])
let tableString = table.render()
print(tableString)
/*
+-----+-----+-----+
| foo | bar | baz |
+-----+-----+-----+
| 1 | 2 | |
| 11 | 22 | 33 |
| 111 | 222 | 333 |
+-----+-----+-----+
*/
Console Formatting Support
SwiftyTextTable will recognize many console escape sequences used to format output (e.g. Rainbow) and account for them in constructing the table.
API Reference
Check out the full API reference here.
License
SwiftyTextTable is released under the MIT License.
*Note that all licence references and agreements mentioned in the SwiftyTextTable README section above
are relevant to that project's source code only.