在多端專案中,共用工具方法與自訂元件可抽成子工程,避免各端重複維護。
透過 File 選單新增 Project,選擇 Static Library,命名後加入主專案。



在主專案 Build Settings 中找到 User Header Search Paths,設定專案絕對路徑並開啟遞歸搜尋。

於 Build Phases 加入子工程 Target,並在 Link Binary With Libraries 加入產生的靜態庫。


若子工程有圖片或資源,可透過 Copy Files 加入;若有 Category,需在 Other Linker Flags 加入 -ObjC 或 -all_load。
