Tutorial by Examples

Debug Print shows the instance representation that is most suitable for debugging. print("Hello") debugPrint("Hello") let dict = ["foo": 1, "bar": 2] print(dict) debugPrint(dict) Yields >>> Hello >>> "Hello" >&gt...
dump prints the contents of an object via reflection (mirroring). Detailed view of an array: let names = ["Joe", "Jane", "Jim", "Joyce"] dump(names) Prints: ▿ 4 elements - [0]: Joe - [1]: Jane - [2]: Jim - [3]: Joyce For a dictionary: let attr...
Many of us start debugging with simple print(). Let's say we have such a class: class Abc { let a = "aa" let b = "bb" } and we have an instance of Abc as so: let abc = Abc() When we run the print() on the variable, the output is App.Abc while dump() output...
In swift we can use both print() and NSLog() functions to print something on Xcode console. But there are lot of differences in print() and NSLog() functions, such as: 1 TimeStamp: NSLog() will print timestamp along with the string we passed to it, but print() will not print timestamp. e.g. let ...

Page 1 of 1