فهرست منبع

Re-use local variable to avoid extra `FIRRemoteConfig` accesses in `RemoteConfigValueObservable` (#14756)

ivan moskalev 11 ماه پیش
والد
کامیت
48af4cb559
1فایلهای تغییر یافته به همراه2 افزوده شده و 2 حذف شده
  1. 2 2
      FirebaseRemoteConfig/Swift/PropertyWrapper/RemoteConfigValueObservable.swift

+ 2 - 2
FirebaseRemoteConfig/Swift/PropertyWrapper/RemoteConfigValueObservable.swift

@@ -45,7 +45,7 @@ class RemoteConfigValueObservable<T: Decodable>: ObservableObject {
     do {
       let configValue: RemoteConfigValue = remoteConfig[key]
       if configValue.source == .remote || configValue.source == .default {
-        self.configValue = try remoteConfig[key].decoded()
+        self.configValue = try configValue.decoded()
       } else {
         self.configValue = fallbackValue
       }
@@ -66,7 +66,7 @@ class RemoteConfigValueObservable<T: Decodable>: ObservableObject {
     do {
       let configValue: RemoteConfigValue = remoteConfig[key]
       if configValue.source == .remote {
-        self.configValue = try remoteConfig[key].decoded()
+        self.configValue = try configValue.decoded()
       }
     } catch {
       // Suppresses a hard failure if decoding failed.