ios – unsupported Swift structure in Goal-C

Spread the love


I have been working with a static library in iOS written in Swift. Under is the script I have been utilizing to construct the library right into a fats framework (common).

# Sort a script or drag a script file out of your workspace to insert its path.

#1. After then, make a contemporary listing listing 

UNIVERSAL_OUTPUTFOLDER=${BUILD_DIR}/${CONFIGURATION}-universal

# be certain the output listing exists

mkdir -p "${UNIVERSAL_OUTPUTFOLDER}"

# 2. Copy System (arm64) Framework to a contemporary common folder location 

cp -a "${BUILD_DIR}/${CONFIGURATION}-iphoneos/${PROJECT_NAME}.framework" "${UNIVERSAL_OUTPUTFOLDER}/"

#3. Copy Sim (x86_64) Frameworks's "MyFramework.swiftmodule" folder content material and paste it in Fats (x86_64 + arm64) Frameworks's "MyFramework.swiftmodule" folder.

SIMULATOR_SWIFT_MODULES_DIR="${BUILD_DIR}/${CONFIGURATION}-iphonesimulator/${PROJECT_NAME}.framework/Modules/${PROJECT_NAME}.swiftmodule/."

if [ -d "${SIMULATOR_SWIFT_MODULES_DIR}" ]; then

cp -R "${SIMULATOR_SWIFT_MODULES_DIR}" "${UNIVERSAL_OUTPUTFOLDER}/${PROJECT_NAME}.framework/Modules/${PROJECT_NAME}.swiftmodule"

fi

# Step 4: Create common binary file utilizing lipo and place the mixed executable within the copied framework listing

lipo -create -output "${UNIVERSAL_OUTPUTFOLDER}/${PROJECT_NAME}.framework/${PROJECT_NAME}" "${BUILD_DIR}/${CONFIGURATION}-iphonesimulator/${PROJECT_NAME}.framework/${PROJECT_NAME}" "${BUILD_DIR}/${CONFIGURATION}-iphoneos/${PROJECT_NAME}.framework/${PROJECT_NAME}"

# Step 5: Copy output to the venture listing.

cp -R "${UNIVERSAL_OUTPUTFOLDER}/${PROJECT_NAME}.framework" "${PROJECT_DIR}"

# Step 6: Open Challenge Listing

open "${PROJECT_DIR}"#1. After then, make a contemporary listing listing 

UNIVERSAL_OUTPUTFOLDER=${BUILD_DIR}/${CONFIGURATION}-universal

# be certain the output listing exists

mkdir -p "${UNIVERSAL_OUTPUTFOLDER}"

# 2. Copy System (arm64) Framework to a contemporary common folder location 

cp -a "${BUILD_DIR}/${CONFIGURATION}-iphoneos/${PROJECT_NAME}.framework" "${UNIVERSAL_OUTPUTFOLDER}/"

#3. Copy Sim (x86_64) Frameworks's "MyFramework.swiftmodule" folder content material & paste it in Fats(x86_64 + arm64) Frameworks's  "MyFramework.swiftmodule" folder.

SIMULATOR_SWIFT_MODULES_DIR="${BUILD_DIR}/${CONFIGURATION}-iphonesimulator/${PROJECT_NAME}.framework/Modules/${PROJECT_NAME}.swiftmodule/."

if [ -d "${SIMULATOR_SWIFT_MODULES_DIR}" ]; then

cp -R "${SIMULATOR_SWIFT_MODULES_DIR}" "${UNIVERSAL_OUTPUTFOLDER}/${PROJECT_NAME}.framework/Modules/${PROJECT_NAME}.swiftmodule"

fi

# Step 4: Create common binary file utilizing lipo and place the mixed executable within the copied framework listing

lipo -create -output "${UNIVERSAL_OUTPUTFOLDER}/${PROJECT_NAME}.framework/${PROJECT_NAME}" "${BUILD_DIR}/${CONFIGURATION}-iphonesimulator/${PROJECT_NAME}.framework/${PROJECT_NAME}" "${BUILD_DIR}/${CONFIGURATION}-iphoneos/${PROJECT_NAME}.framework/${PROJECT_NAME}"

# Step 5: Copy output to the venture listing.

cp -R "${UNIVERSAL_OUTPUTFOLDER}/${PROJECT_NAME}.framework" "${PROJECT_DIR}"

# Step 6. Open Challenge Listing

open "${PROJECT_DIR}"

When built-in with a Swift app, the library works seamlessly for each the simulator and the system. Nonetheless, I am encountering a difficulty when attempting to make use of the library in an Goal-C app on the simulator. The error message states “unsupported Swift structure.” Surprisingly, it really works effective on the system.

If anybody might present help with this subject, I’d enormously admire it. Thanks upfront.

Leave a Reply

Your email address will not be published. Required fields are marked *