Skip to content

Commit e512d66

Browse files
committed
ios [nfc]: Remove unneeded imports in ZulipMobile-Bridging-Header.h
This file, and these lines in it, were added early in the project's history, in d38129b. At that commit, we didn't even have any Swift files in our source tree, so it's unclear what benefit was sought by adding this file, or why these particular lines were chosen. Anyway, as mentioned in the code comment we add now, the lines had the effect of making the named Objective-C modules available in our Swift files without those Swift files needing an import line of their own. They also made transitively imported modules available, apparently including Foundation and UIKit. With the lines removed, we need to add import lines in the Swift files, following Xcode's complaints about what's missing. So, do that.
1 parent e93d47f commit e512d66

File tree

3 files changed

+23
-8
lines changed

3 files changed

+23
-8
lines changed

ios/ZulipMobile-Bridging-Header.h

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,18 @@
1-
#import <React/RCTBridgeModule.h>
2-
#import <React/RCTBridge.h>
3-
#import <React/RCTEventDispatcher.h>
4-
#import <React/RCTRootView.h>
5-
#import <React/RCTUtils.h>
6-
#import <React/RCTConvert.h>
7-
#import <React/RCTEventEmitter.h>
8-
#import <React/RCTBundleURLProvider.h>
1+
// To use an Objective-C module in a Swift file, first just try importing it
2+
// at the top of your Swift file, like so:
3+
//
4+
// import React.RCTBridgeModule
5+
//
6+
// If you can't find an import line that Xcode understands, instead try
7+
// adding an import line in this file, like so:
8+
//
9+
// #import <React/RCTBridgeModule.h>
10+
//
11+
// That should make the module (plus the modules *it* imports, actually)
12+
// available in all our project's Swift files, without the Swift files
13+
// needing an import line of their own.
14+
//
15+
// The first approach (an import line in the Swift file) is preferred
16+
// because it looks like how imports normally work in Swift. But sometimes
17+
// we can't find an import line that works; not sure why. Discussion:
18+
// https://chat.zulip.org/#narrow/stream/243-mobile-team/topic/ios.2FZulipMobile-Bridging-Header.2Eh/near/1520435

ios/ZulipMobile/ZLPConstants.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import Foundation
2+
import UIKit
23

34
@objc(ZLPConstants)
45
class ZLPConstants: NSObject {

ios/ZulipMobile/ZLPNotifications.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
import Foundation
2+
import UIKit
3+
import React.RCTBridgeModule
4+
15
@objc(ZLPNotifications)
26
class ZLPNotifications: NSObject {
37
// For why we include this, see

0 commit comments

Comments
 (0)