Skip to content

Commit

Permalink
Decode number with default value
Browse files Browse the repository at this point in the history
  • Loading branch information
mAllamTapPayments committed Jul 1, 2024
1 parent 7c5ad75 commit 9555bb3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions goSellSDK/Core/API/Public/Models/PhoneNumber.swift
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,8 @@ extension PhoneNumber: Decodable {

let container = try decoder.container(keyedBy: CodingKeys.self)

let isdNumber = try container.decode(String.self, forKey: .isdNumber)
let phoneNumber = try container.decode(String.self, forKey: .phoneNumber)
let isdNumber = try container.decodeIfPresent(String.self, forKey: .isdNumber) ?? ""
let phoneNumber = try container.decodeIfPresent(String.self, forKey: .phoneNumber) ?? ""

try self.init(isdNumber: isdNumber, phoneNumber: phoneNumber)
}
Expand Down

0 comments on commit 9555bb3

Please sign in to comment.