如何在 Swift Playground 中使用 Realm?
How do I use Realm in a Swift Playground?
所以,我是 XCode 开发的新手,但我已经阅读了有关 how to import third party frameworks into a Playground in XCode 7.1.1, and the documentation on how to get started with Realm 的文档,使用的是动态框架安装方法。
此时我有一个工作区,其中包含一个 iOS 项目、Realm 所需的两个 .framework 文件夹和一个 Playground 项目。我构建的工作区没有错误。
我认为通过 Playground 中的一些 Realm 示例是开始的好方法,但做一个简单的:
import RealmSwift
导致“没有这样的模块 'RealmSwift' 错误。我错过了什么?
更新:Realm Swift 现在可以与 Swift Playgrounds 一起使用。您将在 Realm 的发布压缩包 (direct download) 中找到示例。
Realm 目前不支持 Swift 游乐场:https://github.com/realm/realm-cocoa/issues/938
您应该使用 Cocoapods 安装 Realm。
采用的一个好的做法是在使用 Cocoapods 时使用其他支持它的库,例如这个库。这样你就可以始终控制你使用的这个库的版本。
我在 Playground
上玩 RealmSwift
时遇到了同样的问题。我在 single view iOS
应用程序下创建它。在构建我的主要目标后修复它,创建 dynamic framework
链接到 Playground
。
Cocoapod
安装正常,Swift 4.2
,Xcode 10.1
自己试试吧。 https://github.com/sauvikdolui/RealmExploration
所以,我是 XCode 开发的新手,但我已经阅读了有关 how to import third party frameworks into a Playground in XCode 7.1.1, and the documentation on how to get started with Realm 的文档,使用的是动态框架安装方法。
此时我有一个工作区,其中包含一个 iOS 项目、Realm 所需的两个 .framework 文件夹和一个 Playground 项目。我构建的工作区没有错误。
我认为通过 Playground 中的一些 Realm 示例是开始的好方法,但做一个简单的:
import RealmSwift
导致“没有这样的模块 'RealmSwift' 错误。我错过了什么?
更新:Realm Swift 现在可以与 Swift Playgrounds 一起使用。您将在 Realm 的发布压缩包 (direct download) 中找到示例。
Realm 目前不支持 Swift 游乐场:https://github.com/realm/realm-cocoa/issues/938
您应该使用 Cocoapods 安装 Realm。
采用的一个好的做法是在使用 Cocoapods 时使用其他支持它的库,例如这个库。这样你就可以始终控制你使用的这个库的版本。
我在 Playground
上玩 RealmSwift
时遇到了同样的问题。我在 single view iOS
应用程序下创建它。在构建我的主要目标后修复它,创建 dynamic framework
链接到 Playground
。
Cocoapod
安装正常,Swift 4.2
,Xcode 10.1
自己试试吧。 https://github.com/sauvikdolui/RealmExploration