Module 'Swift' was created for incompatible target x86_64-apple-ios13.0

Viewed 2459

I'm creating an iOS framework and I want to copy some Xcode templates from my framework directory (that are not included in my .xcproject, but are in the folder that contains the project), when my framework is installed trought Cocoapods. In other words, when a developer installs my framework with Cocoapods or manually, I want to copy the templates into his Xcode Template Files folder.

I'm trying to execute a swift script file from the build phase of Xcode like this:

swift "${SRCROOT}/Folder/Folder/installer.swift"

But I get this error when I try to build it:

/<unknown>:1:1: module 'Swift' was created for incompatible target x86_64-apple-ios13.0: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Swift.swiftmodule/x86_64.swiftmodule

If I execute swift installer.swift from the terminal, the script works. So, I think there is a problem with my Xcode.

My installer.swift file copies the template files to the Xcode Template Files folder.

I don't know if this way is the correct one, but I didn't find any other solution so far.

1 Answers

When I tried something similar I had to tell swift to compile for macOS by adding the following "shebang" comment as the first line of the swift script:

#!/usr/bin/env xcrun --sdk macosx swift
Related