Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I use Realm in a Swift Playground?

Tags:

xcode

ios

realm

So, I'm pretty new to XCode development, but I've read the documentation on how to import third party frameworks into a Playground in XCode 7.1.1, and the documentation on how to get started with Realm, using the Dynamic Framework method of installation.

At this point I have a workspace that contains an iOS project, the two .framework folders required by Realm, and a Playground project. I have built the workspace without errors.

I figured going through some of the Realm examples in the Playground would be a great way to get going, but doing a simple:

import RealmSwift

results in a "No such module 'RealmSwift' error. What am I missing?

like image 354
Paul Avatar asked Nov 25 '15 16:11

Paul


2 Answers

You should install Realm with Cocoapods.

One good practice to adopt is using Cocoapods when using other librairies like this one when they support it. That way you always have control on the version you're using of this library.

like image 58
Sam Bellerose Avatar answered Nov 03 '22 20:11

Sam Bellerose


Update: Realm Swift works with Swift Playgrounds now. You'll find an example in Realm's release zips (direct download).


Realm doesn't support Swift Playgrounds at the moment: https://github.com/realm/realm-cocoa/issues/938

like image 3
jpsim Avatar answered Nov 03 '22 21:11

jpsim