I'm having trouble setting up unit tests (XCTestCase) for my Xcode project. The project contains Objective-C and Swift files. "Enable testability" and "Define module" set to "YES"
I imported the main project using: @testable import Projectname I created a separate (empty) Bridging header. And make sure that all te files are imported into the target testing group (via Project> Build Phases).
This works fine for all Objective-C classes / files, but not with fast classes with Objective-C functions in it. When I run the test, it fails. And almost all #import lines in the main header of the bridge receive the same warning: "Pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified)"
I also get a warning for the class I'm trying to import:
"Undefined symbols for architecture x86_64: "Project.BaseController.__allocating_init () -> Project.BaseController", referenced from: Main_App.ProjectTests.setUp () -> () in ProjectTests.o "type metadata accessor for Flitsmeister.BaseController", referenced from: Main_App.ProjectTests.setUp () -> () in ProjectTests.o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation)"
Is it possible to test Swift files with imported Objective-C code? Are there any workarounds?
ios objective-c xcode swift
I. Duits
source share