Swift compiler crashes when importing RealmSwift - ios

In a totally new project, with no code except for the default template, when I import RealmSwift Xcode shows a Swift compiler error like this:
I've followed the Realm installation guide many times over for both CocoaPods and manually installing into a project.
When I don't import RealmSwift, I can build the project.
I'm using Swift version 3.0.2.

I think you're hitting a known issue with the Swift compiler that leads to it crashing when you import a module with the same name as your application target. In this case, you've named your app target "Realm". That's the name of the Objective-C framework that RealmSwift depends on. Importing RealmSwift attempts to import the Realm module, which causes the compiler to get confused because it's not sure if that Realm module is referring to your app or the Realm framework. Renaming your application target so it doesn't share the name with any other modules you depend on should work around this compiler bug.

Related

"Error: Missing required module 'CryptorRSA'" after importing Swift framework

I have a Swift project with a target that we'll call 'ProjectTarget'. ProjectTarget depends on this 'CryptorRSA' framework, which was added to the project using Swift Package Manager.
CryptorRSA is imported into a few files (via 'import CryptorRSA') within ProjectTarget and everything is working swimmingly. ProjectTarget is then exported as a framework and imported into an Objective-C app. Now, the Obj-C app which is trying to utilize the ProjectTarget framework is saying "Missing required module 'CryptorRSA'". I added the CryptorRSA package directly to the Obj-C app via Swift Package Manager and that did not solve the issue.
It's probably worth mentioning that this was not an issue prior to Xcode 13. Any help would be much appreciated!
I've already checked several related posts on SO, including:
Swift app: “Missing required module” when importing framework that imports static library
Xcode: missing required module error
Swift Project: "Missing Required Modules" when import a modular framework

PayMill SDK iOS swift 3.0 Xcode 8.1

I'm trying to use PayMill SDK in a Swift project.
I used CocoaPods as described by PayMill, the framework, and it generated 'Pods_PayMilDSK'
After that I tried to import it on my file but I can't get access to any to the functions included in the framework.
I also tried to import the framework directly in my project but I can't access the PayMillSDK framework (i.e. import does not 'see' it).
Any help would be greatly appreciated.
Rodolphe
After running pod install You should always Build your project, cmd + B, because your project still hasn't read the contents of the library you just installed.
Also make sure you're using the .xcworkspace and not the .xcodeproj
I can now make the import of the PAyMill module but functions are not available

Xcode error importing module not being imported

I left Xcode unsupervised for the weekend and I come back and it's telling me I have missing modules Corelocation and SQLite at:
import SQLite
import CoreLocation
both giving me the error Missing required module 'CSQLite'. I'm not sure where its getting "CSQLite" especially in relation to Corelocation
I have the SQLite.xcodeproj added to the general page to be linked it was building fine a couple days ago and absolutely nothing's changed.
In swift, if you want to use sqlite, you can either use modulemap feature of llvm to import c library or you can use cocoapods and import sqlite based any third party pod.

How do I use Realm in a Swift Playground?

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?
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.
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
I faced the same issue while playing with RealmSwift on a Playground. I create it under a single view iOS application. Fixed it after building my main target, as creates the dynamic framework to be linked into the Playground.
Working fine with Cocoapod installation, Swift 4.2, & Xcode 10.1
Try it yourself. https://github.com/sauvikdolui/RealmExploration

Can't use realm framework in Swift 2 application

I'm running the latest beta of El Capitan along with the latest Xcode 7 Beta.
I'm trying to import the Realm framework to use in my iOS application. I've followed the specific instructions for the Swift 2 installation and imported the Realm and RealmSwift frameworks into the embedded binaries.
I copied the files over and my Framework Search Paths is set to $(SRCROOT) - recursive.
On trying to build I'm getting "No such module 'Realm'" and it starts giving build errors on getting JSON values
I've tried importing RealmSwift instead and I receive this error
I've done all the recommended steps, cleaning, deleting derivedData, even moved my source code to a new project all with the same error.
Does anyone have any recommendations on how to solve this issue?

Resources