Import XCTest into a dynamic framework

后端 未结 1 428
时光说笑
时光说笑 2021-02-02 00:42

I have a project where I have created a dynamic framework. Inside the framework itself, not the framework\'s tests, I have the following file:

import Foundation
         


        
相关标签:
1条回答
  • 2021-02-02 01:02

    I've run into similar issue and used build settings from Nimble project. To fix issue:

    1: Add to Other Linker Flags:

    -weak_framework XCTest -weak-lswiftXCTest

    2: Add to Framework Search Paths:

    $(DEVELOPER_FRAMEWORKS_DIR) $(PLATFORM_DIR)/Developer/Library/Frameworks

    Now dynamic framework can import XCTest.

    Sidenote: I also wanted to write something similar. I've ended up creating mini-framework for unit testing error handling in Swift, maybe someone will find it useful. Works both with CocoaPods and Carthage.

    0 讨论(0)
提交回复
热议问题