0
votes

I am trying to import a framework into swift using the Swift Package manager because a Pod is not available for it. The import does not appear in the project classes and none of its functions are available. I am currently running Swift 3.1 and have done the following in terminal: swift build, swift package generate-xcodeproj, and cleaned the project. Here is my Package.swift:

// swift-tools-version:3.1

import PackageDescription

let package = Package(
    name: "MyPackage",
    dependencies: [
        .Package(url: "https://github.com/WeirdMath/Scrape.git", majorVersion: 1)
    ]
)

I have gotten the following output in terminal:

-Compile Swift Module 'MyPackage' (2 sources)

-note: you may be able to install libxml-2.0 using your system-packager: brew install libxml2

Is there a way to compile the package further or to install libxml? Note: the frameworks libxml2.0 & libxml2.2 are already installed.

1

1 Answers

0
votes

I'm not sure I understand your problem, but I'll write here steps I followed to make it work:

  1. I've created directory for project and called swift package init --type executable
  2. Modified Package.swift to reflect yours
  3. swift build to get:

    -note: you may be able to install libxml-2.0 using your system-packager: brew install libxml2

  4. Called brew install libxml2

  5. swift build again - this time without any warnings
  6. swift package generate-xcodeproj
  7. Opened it in Xcode and added import Scrape in main.swift

Everything works fine, I guess?