Mercurial > public > simoleon
diff Simoleon/Helpers/CurrencyRow.swift @ 150:6eac99e99b96
Add error handling to read json function
author | Dennis Concepcion Martin <dennisconcepcionmartin@gmail.com> |
---|---|
date | Thu, 19 Aug 2021 19:12:56 +0100 |
parents | 04feeb708833 |
children | 2584fd74235a |
line wrap: on
line diff
--- a/Simoleon/Helpers/CurrencyRow.swift Thu Aug 19 19:12:31 2021 +0100 +++ b/Simoleon/Helpers/CurrencyRow.swift Thu Aug 19 19:12:56 2021 +0100 @@ -10,10 +10,10 @@ struct CurrencyRow: View { var currencyPairName: String var isLocked: Bool? - let currencyMetadata: [String: CurrencyMetadataModel] = parseJson("CurrencyMetadata.json") var body: some View { HStack { + let currencyMetadata: [String: CurrencyMetadataModel] = try! read(json: "CurrencyMetadata.json") let currencies = currencyPairName.split(separator: "/") Image(currencyMetadata[String(currencies[0])]!.flag) .resizable()