You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
MixObjC depends on MixCore and is implemented in Objective-C.
Mix depends on both above targets and is implemented in Swift.
Expected behavior
Mix scheme can be built successfully.
Actual behavior
Mix scheme can't be built.
Steps to reproduce
Open this project in Xcode.
MixObjC scheme can be built successfully.
Xcode reports an error when building Mix scheme: "module not found" error in MixObjc/ObjC.h.
Swift Package Manager version/commit hash
Release 5.7
Swift & OS version (output of swift --version && uname -a)
swift-driver version: 1.62.15 Apple Swift version 5.7.1 (swiftlang-5.7.1.135.3 clang-1400.0.29.51)
Target: arm64-apple-macosx12.0
Darwin A8C-MBP.local 21.6.0 Darwin Kernel Version 21.6.0: Thu Sep 29 20:13:56 PDT 2022; root:xnu-8020.240.7~1/RELEASE_ARM64_T6000 arm64
The text was updated successfully, but these errors were encountered:
Looks like in Xcode, there's no -fmodule-map-path being passed to MixCore.modulemap when building the "Mix" target, but the package appears to build with swift build. cc @abertelrud
When declarations in an Objective-C header file refer to a Swift class or protocol that comes from the same target, importing the generated header creates a cyclical reference. To avoid this, use a forward declaration of the Swift class or protocol to reference it in an Objective-C interface.
Therefore, it's better to avoid importing MixObjC in the .h file:
#import<Foundation/Foundation.h>
@import MixCore; // HERE: Replace it with `@class MixCoreClass;`@interfaceMixObjC: NSObject@property (nonatomic, strong) MixCoreClass *core;
@property (nonatomic, assign) int value;
@end
This will solve your "module not found" error. However, you will get another error when you import the MixObjC into a Swift file to access the property core:
Value of type 'MixObjC' has no member 'core'
This issue occurs in a situation of such package dependencies:
Description
Mix.zip is an example Swift package.
There are three targets in this package:
MixCore
is implemented in Swift.MixObjC
depends onMixCore
and is implemented in Objective-C.Mix
depends on both above targets and is implemented in Swift.Expected behavior
Mix
scheme can be built successfully.Actual behavior
Mix
scheme can't be built.Steps to reproduce
MixObjC
scheme can be built successfully.Mix
scheme: "module not found" error inMixObjc/ObjC.h
.Swift Package Manager version/commit hash
Release 5.7
Swift & OS version (output of
swift --version && uname -a
)swift-driver version: 1.62.15 Apple Swift version 5.7.1 (swiftlang-5.7.1.135.3 clang-1400.0.29.51)
Target: arm64-apple-macosx12.0
Darwin A8C-MBP.local 21.6.0 Darwin Kernel Version 21.6.0: Thu Sep 29 20:13:56 PDT 2022; root:xnu-8020.240.7~1/RELEASE_ARM64_T6000 arm64
The text was updated successfully, but these errors were encountered: