Skip to content

Commit d12eb34

Browse files
authored
[Config] Lock down no-op API's availability for Swift clients (#11764)
1 parent 9fcb6a6 commit d12eb34

File tree

2 files changed

+30
-15
lines changed

2 files changed

+30
-15
lines changed

FirebaseRemoteConfig/Swift/Codable.swift

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -20,21 +20,6 @@ import Foundation
2020
#endif // SWIFT_PACKAGE
2121
import FirebaseSharedSwift
2222

23-
#if SWIFT_PACKAGE
24-
// This is a trick to force generate a `FirebaseRemoteConfig-Swift.h` header
25-
// that re-exports `FirebaseRemoteConfigInternal` for Objective-C clients. It
26-
// is important for the below code to reference a Remote Config symbol defined
27-
// in Objective-C as that will import the symbol's module
28-
// (`FirebaseRemoteConfigInternal`) in the generated header. This allows
29-
// Objective-C clients to import Remote Config's Objective-C API using
30-
// `@import FirebaseRemoteConfig;`. This API is not needed for Swift clients
31-
// and is therefore hidden for them for the foreseeable future.
32-
@available(iOS 100, *)
33-
@objc public extension RemoteConfig {
34-
var __do_not_call: String { "" }
35-
}
36-
#endif // SWIFT_PACKAGE
37-
3823
public enum RemoteConfigValueCodableError: Error {
3924
case unsupportedType(String)
4025
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
// Copyright 2023 Google LLC
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
#if SWIFT_PACKAGE
16+
@_exported import FirebaseRemoteConfigInternal
17+
18+
// This is a trick to force generate a `FirebaseRemoteConfig-Swift.h` header
19+
// that re-exports `FirebaseRemoteConfigInternal` for Objective-C clients. It
20+
// is important for the below code to reference a Remote Config symbol defined
21+
// in Objective-C as that will import the symbol's module
22+
// (`FirebaseRemoteConfigInternal`) in the generated header. This allows
23+
// Objective-C clients to import Remote Config's Objective-C API using
24+
// `@import FirebaseRemoteConfig;`. This API is not needed for Swift clients
25+
// and is therefore unavailable in a Swift context.
26+
@available(*, unavailable)
27+
@objc public extension RemoteConfig {
28+
static var __no_op: () -> Void { {} }
29+
}
30+
#endif // SWIFT_PACKAGE

0 commit comments

Comments
 (0)