2

Im new with Swift and its tools. I use this extension.
I added a package to dependencies but when I try to import my package

import SwiftyJSON

terminal gives me an error:

error: no such module 'SwiftyJSON'
import SwiftyJSON
       ^

My Package.swift file:

// swift-tools-version:4.0
import PackageDescription

let package = Package(
    name: "swiftpackages",
    dependencies: [
        .package(url: "https://github.com/SwiftyJSON/SwiftyJSON.git", from: "4.0.0"),
    ]
)

How I can fix this problem?

6
  • Try running swift package update from the same directory where your Package.swift file is located. Commented May 21, 2022 at 23:13
  • You should replace SwiftyJson by the native JsonDecoder. It is so much more useful (and so much more swifty :-). Commented May 22, 2022 at 0:37
  • @Patru It's all about process and not about exactly this package, I just wanna learn how to add packages in VS Code :) Commented May 22, 2022 at 9:07
  • @VadimBelyaev I already tried to update the package and it's up-to-date. I think there is a problem in VS Code Commented May 22, 2022 at 9:14
  • How is your code structured, how many modules do you have? Are you importing SwiftyJson in the file that is a part of the same package or from a different package? Commented May 22, 2022 at 12:27

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.