We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d3e6d05 commit 11293b6Copy full SHA for 11293b6
Sources/Lookup/Lookup.swift
@@ -548,7 +548,12 @@ public extension Lookup {
548
549
// MARK: - Int
550
var int: Int? {
551
- (string as NSString?)?.integerValue
+ switch rawType {
552
+ case .bool:
553
+ rawBool ? 1 : 0
554
+ default:
555
+ (string as NSString?)?.integerValue
556
+ }
557
}
558
var intValue: Int {
559
int!
Tests/LookupTests/LookupTests.swift
@@ -410,6 +410,10 @@ struct LookupTests {
410
411
"""
412
let clookup = Lookup(json)
413
+ #expect(clookup.b.bool == true)
414
+ #expect(clookup.b.int == 1)
415
+ #expect(clookup.i.int == 1)
416
+ #expect(clookup.i.bool == true)
417
#expect(clookup.description.contains("true"))
418
419
let data = try JSONEncoder().encode(clookup)
0 commit comments