objective-c - How to temporarily disable Swift to Objective-C bridging header auto-generation?
问题描述
Background
Let's say project App is a 50/50 mixed Swift/Objective-C codebase. Objective-C files import some Swift via auto-generated "App-Swift.h" file.
#import "App-Swift.h"
Recap on How it Works
"App-Swift.h" file automatically includes all the Swift's classes inherited from Objective-C ones: NSObject, UIView, UITableViewCell, UIViewController, etc; and of course all the @objc and @objcMemmbers attributed things.
The Issue
When anything is added to the "App-Swift.h" - all the Objective-C files that import it - have to be recompiled. Even if what was added to Swift is actually not used in any of Objective-C files, but we just inherited from, e.g., UIView.
It all adds up when you import "App-Swift.h" into many files and it slows you down.
Possible Proper Solutions
Break down the codebase into small modules, so interface segregates; avoid NSObject inheritance; Convert as much Objective-C to Swift as possible; private all @IBOutlet, @IBAction during development; etc.
The Question: Cutting a Corner
Is there a way to disable Swift to Objective-C bridging header ("App-Swift.h") auto-generation (but keep the last generated App-Swift.h) at least manually via any of Swift compiler flags?
Any other quick win ideas here?
Related References Revised
Swift and Objective-C interoperability
https://dmtopolog.com/code-optimization-for-swift-and-objective-c/
https://swift.org/blog/bridging-pch/
https://developer.apple.com/documentation/swift/imported_c_and_objective-c_apis/importing_swift_into_objective-c
Going into modules
https://blog.griddynamics.com/modular-architecture-in-ios/
https://www.bignerdranch.com/blog/it-looks-like-you-are-trying-to-use-a-framework/
https://www.bignerdranch.com/blog/it-looks-like-youre-still-trying-to-use-a-framework/
解决方案
推荐阅读
- dagger-2 - 构造函数注入使 Dagger 2 和 mvp 中的 MissingBinding
- android - 如何在回收站视图中更新多个 sqlite 数据?
- jquery - bootstrap 4 在删除确认框中显示错误
- c - 访问结构成员时返回字节,打印结构变量地址时发生分段错误
- php - 任何检查域的 php 函数是否被列入黑名单。我正在使用 checkdnsrr( $domain . '.', 'MX' ) 但它显示 yopmail.com 有效
- dynamics-crm - Dynamics 365 版本 9 中的 ManageEntitlementState 工作流
- android - 在android中的适配器内创建datePicker
- javascript - if(数字)返回什么?
- excel - 循环遍历 Excel 表单中的所有控件
- php - 为什么 WordPress locate_template 不加载变量?