'Module was not compiled for testing' when using @testable

前端 未结 10 857
难免孤独
难免孤独 2020-12-04 14:00

I\'m trying to use Swift 2\'s new @testable declaration to expose my classes to the test target. However I\'m getting this compiler error:

10条回答
  •  执笔经年
    2020-12-04 14:28

    If by any chance you have

    install! 'cocoapods',
             generate_multiple_pod_projects: true,
             incremental_installation: true
    

    Then, this is the way to do it.

        # generated_projects only returns results if the we run "pod install --clean-install"
        # or install a pod for the first time
    
        installer.generated_projects.each do |project|
            project.build_configurations.each do |configuration|
                configuration.build_settings["ENABLE_TESTABILITY"] = "YES" 
            end
        end
    

提交回复
热议问题