From ed38393eaa9daa5e02512ed0f1c6ba1d82096bcd Mon Sep 17 00:00:00 2001 From: mertyldrr Date: Tue, 12 Nov 2024 21:49:13 +0100 Subject: [PATCH] chore(barcode-scanning): use if let to avoid the force unwrap --- .../ios/Plugin/BarcodeScannerHelper.swift | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/packages/barcode-scanning/ios/Plugin/BarcodeScannerHelper.swift b/packages/barcode-scanning/ios/Plugin/BarcodeScannerHelper.swift index 8cf009a..f0698e5 100644 --- a/packages/barcode-scanning/ios/Plugin/BarcodeScannerHelper.swift +++ b/packages/barcode-scanning/ios/Plugin/BarcodeScannerHelper.swift @@ -81,35 +81,35 @@ public class BarcodeScannerHelper { result["bytes"] = convertDataToJsonArray(rawData) } result["cornerPoints"] = cornerPointsResult - if barcode.calendarEvent != nil { + if let barcode.calendarEvent { result["calendarEvent"] = extractCalendarEventProperties(barcode.calendarEvent!) } - if barcode.contactInfo != nil { + if let barcode.contactInfo { result["contactInfo"] = extractContactInfoProperties(barcode.contactInfo!) } result["displayValue"] = barcode.displayValue - if barcode.driverLicense != nil { + if let barcode.driverLicense { result["driverLicense"] = extractDriverLicenseProperties(barcode.driverLicense!) } - if barcode.email != nil { + if let barcode.email { result["email"] = extractEmailProperties(barcode.email!) } result["format"] = convertBarcodeScannerFormatToString(barcode.format) - if barcode.geoPoint != nil { + if let barcode.geoPoint { result["geoPoint"] = extractGeoPointProperties(barcode.geoPoint!) } - if barcode.phone != nil { + if let barcode.phone { result["phone"] = extractPhoneProperties(barcode.phone!) } result["rawValue"] = barcode.rawValue - if barcode.sms != nil { + if let barcode.sms { result["sms"] = extractSmsProperties(barcode.sms!) } - if barcode.url != nil { + if let barcode.url { result["url"] = extractUrlBookmark(barcode.url!) } result["valueType"] = convertBarcodeValueTypeToString(barcode.valueType) - if barcode.wifi != nil { + if let barcode.wifi { result["wifi"] = extractWifiProperties(barcode.wifi!) } return result