From b5dcd6349a5126f77725b198850ae94167c57534 Mon Sep 17 00:00:00 2001 From: Nick Cooke Date: Tue, 12 Sep 2023 21:29:22 -0400 Subject: [PATCH] Add workaround for Swift header --- .../Source/SPMSwiftHeaderWorkaround.swift | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 FirebaseInAppMessaging/Swift/Source/SPMSwiftHeaderWorkaround.swift diff --git a/FirebaseInAppMessaging/Swift/Source/SPMSwiftHeaderWorkaround.swift b/FirebaseInAppMessaging/Swift/Source/SPMSwiftHeaderWorkaround.swift new file mode 100644 index 000000000000..bc130b67b0b7 --- /dev/null +++ b/FirebaseInAppMessaging/Swift/Source/SPMSwiftHeaderWorkaround.swift @@ -0,0 +1,30 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#if SWIFT_PACKAGE + @_exported import FirebaseInAppMessagingInternal + + // This is a trick to force generate a `FirebaseInAppMessaging-Swift.h` + // header that re-exports `FirebaseInAppMessagingInternal` for Objective-C + // clients. It is important for the below code to reference a Remote + // Config symbol defined in Objective-C as that will import the symbol's + // module (`FirebaseInAppMessagingInternal`) in the generated header. This + // allows Objective-C clients to import Remote Config's Objective-C API + // using `@import FirebaseInAppMessaging;`. This API is not needed for Swift + // clients and is therefore unavailable in a Swift context. + @available(*, unavailable) + @objc public extension InAppMessaging { + static var __no_op: () -> Void { {} } + } +#endif // SWIFT_PACKAGE