简体   繁体   中英

Trouble using Charts Framework in an iOS App project with Swift Package manager

I added the Charts framework (from Danielgindi) to my iOS xcode project using the Swift Package Manager. This installed correctly and the dependency appears to be correct in the config screens. But when I try to add the library to the ViewController.swift file in my empty project with "import Charts" but I get Xcode build error "no such module Charts"

I don't believe this is an issue with my xcode config as I have successfully added other swift packages in exactly the same way and then was able to import their libraries without error. Has anyone else encountered this?

Charts Environment Charts version/Branch/Commit Number: 3.6 (I think whatever latest is) Xcode version: Version 12.2 (12B45b) Swift version: 5.2 Xcode: 11.1

I ran into this same problem and spent the last few hours figuring out a solution so I can start using charts with SPM:-)

First of all, it looks like there are some errors in the current master branch of Charts. There are a few pull requests to fix the issue, here's the one that worked for me. https://github.com/ArthurValiev/Charts/tree/bugfix/spm_build_fix Based on issue #4550

In Xcode I added https://github.com/ArthurValiev/Charts.git to the SPM dialog and typed in branch bugfix/spm_build_fix instead of master and only checked Charts (not DynamicCharts). I then was able to build the project and Import Charts.

This seems to be a temporary solution until the fix is merged into the latest build or master branch.

UPDATE... This fix has been added the latest master branch. I've successfully imported Charts and built using SPM and master branch. https://github.com/danielgindi/Charts/commit/30cd352013d489ea49fd605dd2c0f3d6c685d0a5

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM