'Import Swift Packages in Visual Studio Code

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?



Solution 1:[1]

A constructor template doesn't count as copy constructor even if it has the correct signature of a copy constructor for some template argument.

This is important because if there is no copy constructor declared by the user, then the compiler will declare an implicit one.

So for example

struct A {
    A() {}

    template<typename T>
    A(const T&) { std::cout << "Template called!"; }
};

int main() {
    A a;
    A b = a;
}

will not output Template called!. Instead of the template specialization the implicitly declared copy constructor (which does nothing in this case) is called.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 user17732522