From 17aa86cd6b025310dc696358b8ddc0e6367ff850 Mon Sep 17 00:00:00 2001 From: Levi Eggert Date: Fri, 21 Jun 2024 14:26:30 -0400 Subject: [PATCH] update to check for key isEmpty combine both guards --- .../Bundle/LocalizableStringsBundle.swift | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Sources/LocalizationServices/Bundle/LocalizableStringsBundle.swift b/Sources/LocalizationServices/Bundle/LocalizableStringsBundle.swift index 728f22e..1c3accf 100644 --- a/Sources/LocalizationServices/Bundle/LocalizableStringsBundle.swift +++ b/Sources/LocalizationServices/Bundle/LocalizableStringsBundle.swift @@ -20,14 +20,14 @@ public class LocalizableStringsBundle { } public func stringForKey(key: String) -> String? { - - let localizedString: String = bundle.localizedString(forKey: key, value: LocalizableStringsBundle.uniqueValue, table: nil) - guard !localizedString.isEmpty else { + guard !key.isEmpty else { return nil } - guard localizedString != LocalizableStringsBundle.uniqueValue else { + let localizedString: String = bundle.localizedString(forKey: key, value: LocalizableStringsBundle.uniqueValue, table: nil) + + guard !localizedString.isEmpty && localizedString != LocalizableStringsBundle.uniqueValue else { return nil }