Skip to content

Commit e9650ee

Browse files
Merge pull request #40 from ScalaInc/fix/logs
Fix/logs
2 parents cc1aa19 + 5abd0cc commit e9650ee

File tree

2 files changed

+20
-19
lines changed

2 files changed

+20
-19
lines changed

ExpSwift/Classes/Logging.swift

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -8,24 +8,23 @@
88

99
import Foundation
1010

11-
1211
func expLogging<T>(_ object: @autoclosure () -> T, _ file: String = #file, _ function: String = #function, _ line: Int = #line) {
13-
#if DEBUG
14-
let value = object()
15-
let stringRepresentation: String
16-
17-
if let value = value as? CustomDebugStringConvertible {
18-
stringRepresentation = value.debugDescription
19-
} else if let value = value as? CustomStringConvertible {
20-
stringRepresentation = value.description
21-
} else {
22-
fatalError("expLogging only works for values that conform to CustomDebugStringConvertible or CustomStringConvertible")
23-
}
24-
25-
let fileURL = NSURL(string: file)?.lastPathComponent ?? "Unknown file"
26-
let queue = NSThread.isMainThread() ? "UI" : "BG"
27-
28-
NSLog("<\(queue)> \(fileURL) \(function)[\(line)]: " + stringRepresentation)
29-
#endif
12+
#if DEBUG
13+
let value = object()
14+
let stringRepresentation: String
15+
16+
if let value = value as? CustomDebugStringConvertible {
17+
stringRepresentation = value.debugDescription
18+
} else if let value = value as? CustomStringConvertible {
19+
stringRepresentation = value.description
20+
} else {
21+
fatalError("epxLoggingPrint only works for values that conform to CustomDebugStringConvertible or CustomStringConvertible")
22+
}
23+
24+
let fileURL = URL(string: file)?.lastPathComponent ?? "Unknown file"
25+
let queue = Thread.isMainThread ? "UI" : "BG"
26+
27+
print("<\(queue)> \(fileURL) \(function)[\(line)]: " + stringRepresentation)
28+
#endif
3029
}
3130

ExpSwift/Classes/Thing.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,9 @@ public final class Thing: Model,ResponseObject,ResponseCollection,ModelProtocol
2525
}
2626
}
2727
if let dic = representation?["experience"] as? NSDictionary {
28-
self.experience = Experience(response:response, representation: representation?["experience"])
28+
if let uuid = dic.value(forKeyPath: "uuid") as? String {
29+
self.experience = Experience(response:response, representation: representation?["experience"])
30+
}
2931
}
3032
super.init(response: response, representation: representation)
3133
}

0 commit comments

Comments
 (0)