1

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?

KeoFoxy
  • 41
  • 3
  • Try running `swift package update` from the same directory where your `Package.swift` file is located. – Vadim Belyaev May 21 '22 at 23:13
  • You should replace `SwiftyJson` by the native `JsonDecoder`. It is so much more useful (and so much more swifty :-). – Patru May 22 '22 at 00:37
  • @Patru It's all about process and not about exactly this package, I just wanna learn how to add packages in VS Code :) – KeoFoxy May 22 '22 at 09:07
  • @VadimBelyaev I already tried to update the package and it's up-to-date. I think there is a problem in VS Code – KeoFoxy May 22 '22 at 09: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? – Vadim Belyaev May 22 '22 at 12:27
  • @VadimBelyaev There is no code yet. I just wanna import this package as module for the next use. I have 2 files: `Package.swfit` with my package and `testSwiftPackages.swift` where I import this module. It's my main file. No other modules/packages – KeoFoxy May 22 '22 at 12:59

0 Answers0