Skip to content

Commit aadf50a

Browse files
committed
use arch macro to fix problems of SwiftUI building for armv7 devices
1 parent 92df894 commit aadf50a

File tree

2 files changed

+53
-51
lines changed

2 files changed

+53
-51
lines changed

FirebaseRemoteConfigSwift.podspec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ app update.
2121

2222
s.swift_version = '5.3'
2323

24-
ios_deployment_target = '11.0'
24+
ios_deployment_target = '10.0'
2525
osx_deployment_target = '10.12'
26-
tvos_deployment_target = '11.0'
26+
tvos_deployment_target = '10.0'
2727
watchos_deployment_target = '6.0'
2828

2929
s.ios.deployment_target = ios_deployment_target

FirebaseRemoteConfigSwift/Sources/PropertyWrapper/PropertyWrapper.swift

Lines changed: 51 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -14,66 +14,68 @@
1414
* limitations under the License.
1515
*/
1616

17-
import SwiftUI
1817
import FirebaseRemoteConfig
18+
import SwiftUI
1919

20-
/// A property wrapper that listens to a Remote Config value.
21-
@available(iOS 14.0, macOS 11.0, macCatalyst 14.0, tvOS 14.0, watchOS 7.0, *)
22-
@propertyWrapper
23-
public struct RemoteConfigProperty<T: Decodable>: DynamicProperty {
24-
@State private var configValueObserver: RemoteConfigValueObservable<T>
20+
#if compiler(>=5.5.2) && canImport(SwiftUI) && (arch(arm64) || arch(x86_64))
21+
/// A property wrapper that listens to a Remote Config value.
22+
@available(iOS 14.0, macOS 11.0, macCatalyst 14.0, tvOS 14.0, watchOS 7.0, *)
23+
@propertyWrapper
24+
public struct RemoteConfigProperty<T: Decodable>: DynamicProperty {
25+
@State private var configValueObserver: RemoteConfigValueObservable<T>
2526

26-
/// Remote Config key name for this property
27-
public let key: String
27+
/// Remote Config key name for this property
28+
public let key: String
2829

29-
/// Remote Config instance for this property
30-
public let remoteConfig: RemoteConfig
30+
/// Remote Config instance for this property
31+
public let remoteConfig: RemoteConfig
3132

32-
/// Last fetched status of remote config values
33-
public var lastFetchStatus: RemoteConfigFetchStatus {
34-
return remoteConfig.lastFetchStatus
35-
}
33+
/// Last fetched status of remote config values
34+
public var lastFetchStatus: RemoteConfigFetchStatus {
35+
return remoteConfig.lastFetchStatus
36+
}
3637

37-
/// Last fetched time of remote config values
38-
public var lastFetchTime: Date? {
39-
return remoteConfig.lastFetchTime
40-
}
38+
/// Last fetched time of remote config values
39+
public var lastFetchTime: Date? {
40+
return remoteConfig.lastFetchTime
41+
}
4142

42-
public var wrappedValue: T {
43-
configValueObserver.configValue
44-
}
43+
public var wrappedValue: T {
44+
configValueObserver.configValue
45+
}
4546

46-
/// Creates an instance by defining key.
47-
/// This property depends on default remote config.
48-
///
49-
/// - Parameter key: key name
50-
public init(forKey key: String) {
51-
self.key = key
52-
remoteConfig = RemoteConfig.remoteConfig()
47+
/// Creates an instance by defining key.
48+
/// This property depends on default remote config.
49+
///
50+
/// - Parameter key: key name
51+
public init(forKey key: String) {
52+
self.key = key
53+
remoteConfig = RemoteConfig.remoteConfig()
5354

54-
_configValueObserver = State(
55-
wrappedValue: RemoteConfigValueObservable<T>(
56-
key: key,
57-
remoteConfig: RemoteConfig.remoteConfig()
55+
_configValueObserver = State(
56+
wrappedValue: RemoteConfigValueObservable<T>(
57+
key: key,
58+
remoteConfig: RemoteConfig.remoteConfig()
59+
)
5860
)
59-
)
60-
}
61+
}
6162

62-
/// Creates an instance by defining key and remote config instance.
63-
///
64-
/// - Parameters:
65-
/// - key: key name
66-
/// - remoteConfig: remote config instance
67-
public init(forKey key: String,
68-
remoteConfig: RemoteConfig) {
69-
self.key = key
70-
self.remoteConfig = remoteConfig
63+
/// Creates an instance by defining key and remote config instance.
64+
///
65+
/// - Parameters:
66+
/// - key: key name
67+
/// - remoteConfig: remote config instance
68+
public init(forKey key: String,
69+
remoteConfig: RemoteConfig) {
70+
self.key = key
71+
self.remoteConfig = remoteConfig
7172

72-
_configValueObserver = State(
73-
wrappedValue: RemoteConfigValueObservable<T>(
74-
key: key,
75-
remoteConfig: remoteConfig
73+
_configValueObserver = State(
74+
wrappedValue: RemoteConfigValueObservable<T>(
75+
key: key,
76+
remoteConfig: remoteConfig
77+
)
7678
)
77-
)
79+
}
7880
}
79-
}
81+
#endif

0 commit comments

Comments
 (0)