ReflectedStringConvertible alternatives and similar libraries
Based on the "Logging" category.
Alternatively, view ReflectedStringConvertible 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 -
Rainbow
Delightful console output for Swift developers. -
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. -
Diagnostics
Allow users to easily share Diagnostics with your support team to improve the flow of fixing bugs. -
QorumLogs
:closed_book: Swift Logging Utility for Xcode & Google Docs -
AFNetworkActivityLogger
AFNetworking 3.0 Extension for Network Request Logging -
SwiftTrace
Trace Swift and Objective-C method invocations -
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. -
SwiftyTextTable
A lightweight library for generating text tables. -
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. -
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 ReflectedStringConvertible or a related project?
README
ReflectedStringConvertible
A protocol that extends CustomStringConvertible
and uses reflection to add a
detailed textual representation to any class. Two styles are supported:
normal
: Similar to Swift's default textual representation of structs.json
: Pretty JSON representation.
Installation
Cocoapods
Add the following to your Podfile:
pod 'ReflectedStringConvertible'
Carthage
Add the following to your Cartfile:
github "mattcomi/ReflectedStringConvertible"
Usage
Simply import ReflectedStringConvertible
and conform to the
ReflectedStringConvertible
protocol:
import ReflectedStringConvertible
class YourClass: ReflectedStringConvertible {
// that's all.
}
For example:
class Person: ReflectedStringConvertible {
var name: String
var age: Int
init(name: String, age: Int) {
self.name = name
self.age = age
}
}
print(Person(name: "Matt", age: 33))
outputs:
Person(name: "Matt", age: 33)
A style may be specified with reflectedDescription(style:)
. The default style is normal
. That is, calling description
is the same as calling reflectedDescription(.normal)
.
For example, print(Person(name: "Matt", age: 33).reflectedDescription(.json))
outputs:
{
"age" : 33,
"name" : "Matt"
}
Refer to the API Documentation for further information.
Features
ReflectedStringConvertible
stored properties
ReflectedStringConvertible
objects with ReflectedStringConvertible
stored properties are handled correctly:
class Movie: ReflectedStringConvertible {
var title: String
var year: Int
// another ReflectedStringConvertible
var director: Person
init(title: String, year: Int, director: Person) {
self.title = title
self.year = year
self.director = director
}
}
let george = Person(name: "George Miller", age: 71)
let movie = Movie(title: "Mad Max", year: 2015, director: george)
print(movie.reflectedDescription(.normal))
(or just print(movie)
) outputs:
Movie(title: "Mad Max", year: 2015, director: Person(name: "George Miller", age: 71))
And print(movie.reflectedDescription(.json))
outputs:
{
"title" : "Mad Max",
"year" : 2015,
"director" : {
"age" : 71,
"name" : "George Miller"
}
}
Collections
ReflectedStringConvertible
objects within Array
, Dictionary
and Set
collections are handled correctly:
class Series: ReflectedStringConvertible {
var title: String
var cast: [Person]
init(title: String, cast: [Person]) {
self.cast = cast
}
}
var cast = [Person]()
cast.append(Person(name: "Justin Theroux", age: 44))
cast.append(Person(name: "Carrie Coon", age: 35))
let series = Series(title: "The Leftovers", cast: cast)
print(series)
outputs:
TVShow(title: "The Leftovers", cast: [Person(name: "Justin Theroux", age: 44), Person(name: "Carrie Coon", age: 35)])
print(series.reflectedDescription(.json))
outputs:
{
"title" : "The Leftovers",
"cast" : [
{
"age" : 44,
"name" : "Justin Theroux"
},
{
"age" : 35,
"name" : "Carrie Coon"
}
]
}
Credits
Developed by Matt Comi (@mattcomi)