Swift including JustHTTP/Just build fail - ios

I am using XCode6.4 and I imported JustHTTP/Just (https://github.com/justhttp/Just) library using Carthage.
Import worked fine and here is a screenshot of my xcodeproj file
But on this line:
import Just
I am getting this error
Module file was created by a newer version of the compiler
...../Carthage/Build/iOS/Just.framework/Modules/Just.swiftmodule/x86_64.swiftmodule
Can someone advice? Thanks!

The default branch (v0.3) is on Swift 2. So I had to either switch to Xcode 7 or use github "JustHTTP/Just" ~> v0.1 in my Cartfile.

Related

Module compiled with Swift 5.2.2 cannot be imported by the Swift 5.3 compiler with xcode 12.1

My project was running perfect with xcode 11.4.1 but when i tried to run project xcode 12.1. I got error "Module compiled with Swift 5.2.2 cannot be imported by the Swift 5.3 compiler with xcode 12.1".
Please see attached image. Thanks!
https://i.stack.imgur.com/39k04.png
I had faced same error in Razorpay integreation in a project. I have down grade my xcode version to the supported swift version and the error gone.
Please suggest any other option, if you found. Some thing which does not require to down grade xcode version and works.
I have fixed this issue via remove Carthage from project and added all those modules which was in Carthage via pod and manual add BuckoNetworking files in the project because BuckoNetworking was not available in pod. Import all module in BuckoNetworking files which needed to that files to run project.

Module file was created by a newer version of the compiler

I'm taking over development of a project and am unable to contact the previous developer. I'm trying to figure out which versions of the imbedded open source libraries were used. The project appears to be in Swift 2.1. I am attempting to compile it with Xcode 7.3.1. Carthage was the package manager used. I'm stuck on an error with RealmSwift. The error occurs on the line that tries to import RealmSwift.
/{app source path}/PersonnelModel.swift:10:8: Module file was created
by a newer version of the compiler: /{app source
path}/Carthage/Build/iOS/RealmSwift.framework/Modules/RealmSwift.swiftmodule/x86_64.swiftmodule
I have worked my way all the way back to version 0.96.2 of realm-cocoa, which I believe is the first version to support Xcode 7.1 and Swift 2.1. However, I'm still getting the error.
I have looked through other answers on here, but have not found a solution that works. Am I misunderstanding the cause of the error? I just thought it was picking up a newer version of the framework.
Here is what my Cartfile looks like:
github "ReactiveCocoa/ReactiveCocoa"
github "Alamofire/Alamofire" ~> 3.4
github "SwiftyJSON/SwiftyJSON"
github "realm/realm-cocoa" == 0.96.2
github "scalessec/Toast-Swift" ~> 1.4.0
If you're just trying to get a clean compile for now, it might be worth taking Realm out of Carthage, installing it manually as a dynamic framework, and then putting it back into Carthage at the end once you've got everything smoothed out.
Xcode 7.3.1 was Swift 2.2. The very latest version of Realm to support Swift 2.2 is version 2.3.0, so I'd recommend downloading that version and manually importing it into Xcode 7.3.1
As an aside, Realm has dropped support for Swift 2 starting with version 2.4.0, so it's greatly recommended you migrate your codebase to Swift 3 as soon as possible. :)
I had this issue today in Xcode 8.3.2 w Swift 3. I mistakenly tried to run the swift 3 converter on one class file and canceled it mid run. Xcode then threw this error for one of my Pods (Bolts). Fix was to remove the pod, run pod update, then add the pod back, run pod update again so the module was reset.

Build Swift 3 in Terminal to create XCode project

It seems Apple changed this line:
swift build -X
This no longer works to create an Xcode project as described here
Doest anyone know the updated way to do this as I cannot find it online
Thanks
Now you should use the Swift Package Manager.
To create a project structure:
swift package init --type executable
or
swift package init --type library
To make a project compatible with Xcode:
swift package generate-xcodeproj

No such module "PackageDescription"

I just started with swift 3 and made a simple app in xcode using Swift 3.0 . Now i want to add a third party library using Swift Package Manager . I am following installation method given in this link . I created Package.swift file which looks like this
import PackageDescription
let package = Package (
name : "SwiftPM",
dependencies : [
.Package(url: "https://github.com/ArtSabintsev/Siren.git", majorVersion: 1)
])
but i get error No such module "PackageDescription"
The Swift Package Manager and Xcode are orthogonal. That is, you can't expect to compile Package.swift in Xcode; it simply won't work. Instead, until Xcode supports the package manager, you need to have two distinct builds - one with the package manager and one with Xcode.
So, using the Swift Package Manager, once you've defined Package.swift and formulated your directory structure as expected by the package manger, you perform simply:
swift build
Then for Xcode, you create an Xcode project that uses your source code, but not Package.swift. You'll need to clone the Siren.git project, explicitly - into your Xcode build's source files.
Swift 3/4
Navigate to your project folder through a terminal and run these commands swift package init --type library first and then swift package generate-xcodeproj
Reference
For me the issue turned out to be Target Membership. I created the Package.swift file manually inside an iOS app project.
Solution:
Select and go to the Package.swift file
Open the File Inspector on the right side
Deselect any modules inside Target Membership section
Refer to the solution in this link:
https://forums.kodeco.com/t/server-error-no-such-module-packagedescription/177438
Command:
sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
For other people who faced the same error as this:
Fix your Package.swift syntax
I got this error because Xcode hadn't parsed Package.swift fully yet, because of syntax errors.
In my case, I had a .target(name: "name-of-target", dependencies: [""]). As soon as I removed the empty dependency string (""), Xcode immediately parsed the file, and the error disappeared. Remember to save the file though.
Also, GoZoner and Pratiks answers are outdated:
Xcode has integration with Swift Packages now (as shown above)
swift package generate-xcodeproj is deprecated, shown by the error message when using it:
warning: Xcode can open and build Swift Packages directly. 'generate-xcodeproj' is no longer needed and will be deprecated soon.
More information about what that is, and why its gone here.

Alamofire for Swift 1.2 generates error

After upgrading to the latest build of Xcode and downloading the newest Alamofire release, I am getting the following error:
Module file was created by an older version of the compiler
With the previous version of Alamofire I added the entire AF project into my app as recommended, however the install guide for the latest version of AF says just to copy the .swift file into the project.
I am still calling import Alamofire in the file that requires it. This is also where the error appears. If I remove the import my project generates 86 additional errors.
For me Cleaning up the Build folder Cmd ⌘ + Alt ⌥ + Shift ⇧ + K worked.
Alamofire is updated now for Xcode 6.3, until I know its creator merge the branch for Xcode 6.3 into the branch master in Github , you have to download it to correct the errors for the new Xcode.
But I strongly recommend you installing Alamofire using CocoaPods, I think is better, it's up to you.
I hope this help you.

Resources