diff --git a/CoreStore.podspec b/CoreStore.podspec index 5e285af..174dc61 100644 --- a/CoreStore.podspec +++ b/CoreStore.podspec @@ -15,7 +15,8 @@ Pod::Spec.new do |s| s.source_files = "Sources", "Sources/**/*.{swift}" s.frameworks = "Foundation", "CoreData" s.requires_arc = true - s.pod_target_xcconfig = { 'OTHER_SWIFT_FLAGS' => '-D USE_FRAMEWORKS' } + s.pod_target_xcconfig = { 'OTHER_SWIFT_FLAGS' => '-D USE_FRAMEWORKS', + 'GCC_PREPROCESSOR_DEFINITIONS' => 'USE_FRAMEWORKS=1' } s.dependency "GCDKit", "1.2.5" end \ No newline at end of file diff --git a/CoreStore.xcodeproj/project.pbxproj b/CoreStore.xcodeproj/project.pbxproj index 336900d..1aaccf4 100644 --- a/CoreStore.xcodeproj/project.pbxproj +++ b/CoreStore.xcodeproj/project.pbxproj @@ -2422,6 +2422,7 @@ GCC_PREPROCESSOR_DEFINITIONS = ( "DEBUG=1", "$(inherited)", + "USE_FRAMEWORKS=1", ); GCC_SYMBOLS_PRIVATE_EXTERN = NO; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; @@ -2472,6 +2473,7 @@ ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_PREPROCESSOR_DEFINITIONS = "USE_FRAMEWORKS=1"; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; GCC_WARN_UNDECLARED_SELECTOR = YES; diff --git a/Sources/ObjectiveC/CoreStoreBridge.m b/Sources/ObjectiveC/CoreStoreBridge.m index f2cc659..617397e 100644 --- a/Sources/ObjectiveC/CoreStoreBridge.m +++ b/Sources/ObjectiveC/CoreStoreBridge.m @@ -24,8 +24,20 @@ // #import "CoreStoreBridge.h" + +#if USE_FRAMEWORKS #import +#elif !defined(SWIFT_OBJC_INTERFACE_HEADER_NAME) +#error Add "SWIFT_OBJC_INTERFACE_HEADER_NAME=$(SWIFT_OBJC_INTERFACE_HEADER_NAME)" to the project's GCC_PREPROCESSOR_DEFINITIONS settings + +#else +#define _STRINGIFY(x) #x +#define STRINGIFY(x) _STRINGIFY(x) +#import STRINGIFY(SWIFT_OBJC_INTERFACE_HEADER_NAME) + +#endif + CS_OBJC_OVERLOADABLE CSFrom *_Nonnull CSFromClass(Class _Nonnull entityClass) CS_OBJC_RETURNS_RETAINED {