构建纯Swift Cocoa Touch Framework [英] Building pure Swift Cocoa Touch Framework

查看:205
本文介绍了构建纯Swift Cocoa Touch Framework的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用Xcode-6探索Swift,到目前为止这么好,虽然我认为新集合需要一点点工作,因为我已经打破了编译器几次。



问题是我现在坚持尝试创建框架包以 然后在另一个项目中使用。项目构建没有问题,所有测试成功通过。当我去创建存档(我假设是必需的)我收到错误:


:0:error:underlying Objective- C模块'Sample'not found


现在我假设这与我的Sample.h的内容有关, / p>

  //在此标题中,您应该使用#import< Sample / PublicHeader这样的语句导入框架的所有公共头。 h。 

这是很好,除非我只使用swift枚举,结构和类的框架,所以没有。 h文件存在。



任何人都可以了解这一点,因为我还找不到任何文档吗?

解决方案

我坐了一个工程师,问这个确切的问题。这是他们的回应:



Xcode 6目前不支持构建可分发的Swift框架,苹果很可能不会将这个功能构建到Xcode中,这样做。现在,框架旨在嵌入在您的应用程序的项目中,而不是分布式。如果你观看任何会话视频或看到示例项目,这总是安排。 另一个原因是Swift非常新,可能会改变。因此,您的基于Swift的框架不能保证在您最初构建的平台上运行。



轻微更新 p>

工程师提到,制作一个分发框架是不可能的,只是不支持它。


I'm exploring Swift with Xcode-6 and so far so good although I think the new collections need a little bit of work as I've managed to break the compiler a few times.

Problem is I'm now stuck trying to create the framework package to then use in another project. The project builds without issue and all tests pass successfully. When I go to create Archive (which I assume is what is required) I receive the error:

:0: error: underlying Objective-C module 'Sample' not found

Now I assume this has something to do with the contents of my Sample.h which tells me

// In this header, you should import all the public headers of your framework using statements like #import <Sample/PublicHeader.h>

which is fine except I have only used swift enums, structs and classes for this framework so therefore no .h files exist.

Can anyone shed some light on this one as I can't find any documentation available yet?

解决方案

I sat down with an engineer and asked this exact question. This was their response:

Xcode 6 does not support building distributable Swift frameworks at this time and that Apple likely won't build this functionality into Xcode until its advantageous for them to do so. Right now, Frameworks are meant to be embedded in your app's project, rather than distributed. If you watch any of the session videos or see the sample projects, this is always the arrangement. Another reason is that Swift is very new and likely to change. Thus your Swift-based framework is not guaranteed to work on the platform you originally built it on.

Slight Update

The engineer mentioned that it's not impossible to make a framework for distribution, just that it's not supported.

这篇关于构建纯Swift Cocoa Touch Framework的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆