Add "import Foundation" to any class that is using @objc

Summary:
This is to prevent the following error that was seen in D33750740 (8044535803)
```
objc attribute used without importing module 'Foundation'
```

Found the files with:
```
git ls-files '*.swift' | xargs ack -l 'objc' | xargs ack -L 'import (Foundation|XCTest)'
```

Note: In D33783526 (4610b07bda) a custom SwiftLint rule was added to detect this but it only works if there aren't any other imports.

Reviewed By: samodom

Differential Revision: D33803396

fbshipit-source-id: 575d7798a77aac30384f8f44c1d45f97d60fe8f7
This commit is contained in:
Jawwad Ahmad
2022-01-26 17:46:15 -08:00
committed by Facebook GitHub Bot
parent fcf2a2551c
commit 5face70317
45 changed files with 47 additions and 0 deletions

View File

@@ -7,6 +7,7 @@
*/
import FBAEMKit
import Foundation
@objcMembers
class TestInvocation: AEMInvocation {

View File

@@ -6,6 +6,7 @@
* LICENSE file in the root directory of this source tree.
*/
import Foundation
import UIKit
// swiftformat:disable indent

View File

@@ -7,6 +7,7 @@
*/
import FBSDKCoreKit
import Foundation
@objcMembers
class TestAdvertiserIDProvider: NSObject, AdvertiserIDProviding {

View File

@@ -6,6 +6,7 @@
* LICENSE file in the root directory of this source tree.
*/
import Foundation
import UIKit
// swiftformat:disable indent

View File

@@ -7,6 +7,7 @@
*/
import FBSDKCoreKit
import Foundation
@objcMembers
class TestClientTokenProvider: NSObject, ClientTokenProviding {

View File

@@ -7,6 +7,7 @@
*/
import FBSDKCoreKit
import Foundation
@objcMembers
class TestErrorConfiguration: NSObject, ErrorConfigurationProtocol {

View File

@@ -7,6 +7,7 @@
*/
import FBSDKCoreKit
import Foundation
@objcMembers
class TestEventLogger: NSObject, EventLogging {

View File

@@ -7,6 +7,7 @@
*/
import FBSDKCoreKit
import Foundation
@objcMembers
final class TestGraphRequestPiggybackManager: NSObject, GraphRequestPiggybackManaging {

View File

@@ -7,6 +7,7 @@
*/
import FBSDKCoreKit
import Foundation
@objcMembers
class TestPasteboard: NSObject, Pasteboard {

View File

@@ -6,6 +6,7 @@
* LICENSE file in the root directory of this source tree.
*/
import Foundation
import UIKit
class TestReactNativeView: UIView {

View File

@@ -6,6 +6,8 @@
* LICENSE file in the root directory of this source tree.
*/
import Foundation
// Hacky subclassing to get around init not being available.
// Future work should update ServerConfigurationProvider to return
// a true abstraction instead of a concrete ServerConfiguration and this

View File

@@ -6,6 +6,7 @@
* LICENSE file in the root directory of this source tree.
*/
import Foundation
import TestTools
@objcMembers

View File

@@ -6,6 +6,8 @@
* LICENSE file in the root directory of this source tree.
*/
import Foundation
struct SwizzleEvidence: Equatable {
let selector: Selector
let `class`: AnyClass

View File

@@ -7,6 +7,7 @@
*/
import FBSDKCoreKit
import Foundation
@objcMembers
class TestTokenCache: NSObject, TokenCaching {

View File

@@ -6,6 +6,7 @@
* LICENSE file in the root directory of this source tree.
*/
import Foundation
import UIKit
@objcMembers

View File

@@ -6,6 +6,7 @@
* LICENSE file in the root directory of this source tree.
*/
import Foundation
import UIKit
@objcMembers

View File

@@ -7,6 +7,7 @@
*/
import FBSDKCoreKit
import Foundation
@objc(FBSDKFriendFinderDialog)
public class FriendFinderDialog: NSObject {

View File

@@ -7,6 +7,7 @@
*/
import FBSDKCoreKit
import Foundation
@objcMembers
@objc(FBSDKGamingGroupIntegration)

View File

@@ -7,6 +7,7 @@
*/
import FBSDKCoreKit
import Foundation
@objcMembers
@objc(FBSDKGamingImageUploader)

View File

@@ -6,6 +6,7 @@
* LICENSE file in the root directory of this source tree.
*/
import Foundation
import UIKit
@objcMembers

View File

@@ -7,6 +7,7 @@
*/
import FBSDKCoreKit
import Foundation
@objcMembers
@objc(FBSDKGamingPayload)

View File

@@ -7,6 +7,7 @@
*/
import FBSDKCoreKit
import Foundation
@objcMembers
@objc(FBSDKGamingVideoUploader)

View File

@@ -9,6 +9,7 @@
#if !os(tvOS)
import FBSDKCoreKit
import Foundation
/**
A model for an instant games switchAsync cross play request.

View File

@@ -7,6 +7,7 @@
*/
import FBSDKCoreKit
import Foundation
@objcMembers
class TestAppEvents: AppEvents {

View File

@@ -7,6 +7,7 @@
*/
import FBSDKCoreKit
import Foundation
@objcMembers
class TestLoggerFactory: NSObject, LoggerCreating {

View File

@@ -7,6 +7,7 @@
*/
import FBSDKLoginKit
import Foundation
@objcMembers
class TestLoginCompleter: NSObject, LoginCompleting {

View File

@@ -7,6 +7,7 @@
*/
import FBSDKLoginKit
import Foundation
@objcMembers
class TestLoginCompleterFactory: NSObject, LoginCompleterFactoryProtocol {

View File

@@ -7,6 +7,7 @@
*/
import FBSDKCoreKit
import Foundation
#if !os(tvOS)

View File

@@ -7,6 +7,7 @@
*/
import FBSDKCoreKit
import Foundation
#if !os(tvOS)

View File

@@ -6,6 +6,7 @@
* LICENSE file in the root directory of this source tree.
*/
import Foundation
import TestTools
@objcMembers

View File

@@ -6,6 +6,7 @@
* LICENSE file in the root directory of this source tree.
*/
import Foundation
import UIKit
@objcMembers

View File

@@ -8,6 +8,7 @@
import FacebookGamingServices
import FBSDKCoreKit
import Foundation
@objcMembers
open class FBSDKContextDialogPresenter: NSObject {

View File

@@ -8,6 +8,7 @@
import FacebookGamingServices
import FBSDKCoreKit
import Foundation
/**
A dialog to switch the current context through a web view

View File

@@ -7,6 +7,7 @@
*/
import FBSDKCoreKit
import Foundation
@objcMembers
public class SampleUserProfiles: NSObject {

View File

@@ -7,6 +7,7 @@
*/
import FBSDKCoreKit
import Foundation
@objcMembers
public class TestAccessTokenWallet: NSObject, AccessTokenProviding, AccessTokenSetting, TokenStringProviding {

View File

@@ -7,6 +7,7 @@
*/
import FBSDKCoreKit
import Foundation
@objcMembers
public class TestAuthenticationTokenWallet: NSObject, AuthenticationTokenProviding, AuthenticationTokenSetting {

View File

@@ -7,6 +7,7 @@
*/
@testable import FBSDKCoreKit
import Foundation
@objcMembers
public class TestGraphRequest: NSObject, GraphRequestProtocol {

View File

@@ -7,6 +7,7 @@
*/
import FBSDKCoreKit
import Foundation
@objcMembers
public class TestGraphRequestConnection: NSObject, GraphRequestConnecting {

View File

@@ -7,6 +7,7 @@
*/
import FBSDKCoreKit
import Foundation
@objcMembers
public class TestGraphRequestConnectionFactory: NSObject, GraphRequestConnectionFactoryProtocol {

View File

@@ -7,6 +7,7 @@
*/
import FBSDKCoreKit
import Foundation
@objcMembers
public class TestGraphRequestFactory: NSObject, GraphRequestFactoryProtocol {

View File

@@ -8,6 +8,7 @@
import FBSDKCoreKit
import FBSDKCoreKit_Basics
import Foundation
@objcMembers
public class TestInternalUtility: NSObject,

View File

@@ -7,6 +7,7 @@
*/
import FBSDKCoreKit
import Foundation
@objcMembers
public class TestKeychainStore: NSObject, KeychainStoreProtocol {

View File

@@ -7,6 +7,7 @@
*/
import FBSDKCoreKit
import Foundation
@objcMembers
public class TestKeychainStoreFactory: NSObject, KeychainStoreProviding {

View File

@@ -7,6 +7,7 @@
*/
import FBSDKCoreKit
import Foundation
@objcMembers
public class TestURLOpener: NSObject, URLOpener {

View File

@@ -7,6 +7,7 @@
*/
import FBSDKCoreKit
import Foundation
@objcMembers
public class TestWindowFinder: NSObject, WindowFinding {