How to install a swift library consisting just of swift files

六眼飞鱼酱① 提交于 2019-12-11 10:43:31

问题


Suppose I have a swift library that consists of a large folder with subfolders with subfolders all containing many .swift files I would like my .swift project to be aware of - just as if I had written all that code myself.

My swift project targets ios7+ meaning there are some issues with various package systems - and the given library I am trying to add acually suggests using the above method.

Currenly I have "attached" the swift-library-folder next to my own .swift files and during this I checked all targets.

Interestingly, I can not change/add targets for any of the files in the folder since the option does not show itself when clicking the .swift files in xcode (!)

Anyhow, when trying to use one of the classes defined in he swift-library, xcode does not recognize it.

What am i doing wrong?


回答1:


My guess is that you dragg the folder containing these files into Xcode, rather than the individual files. That was the first issue, since that sort of thing has a special meaning. Then, you saw a dialog like this:

I'm not sure what you did at that moment, but I don't think your settings looked like mine! They need to. Delete the files and perform this import again.

For best results, select just the Swift files in the Finder and drag them into Xcode this time. (You can drag them all at once, in one move; but drag the files, not a folder.) But if you can't do that, make sure you are creating groups — not folder references.



来源:https://stackoverflow.com/questions/35784887/how-to-install-a-swift-library-consisting-just-of-swift-files

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!