3

I want to create my own Framework that will use RealityKit functionalities. Framework project compiles properly without errors, but when I import it to my new project and try to compile I get an error

"Module 'RealityKit' not found"

Can I add RealityKit somehow to my Framework so it will be included or should I change path somewhere ?

When I import RealityKit directly to new project it works, but when I try importing my Framework I get this error.

I get the error at this point in MyFramework-Swift.h

#if __has_feature(modules)
#if __has_warning("-Watimport-in-framework-header")
#pragma clang diagnostic ignored "-Watimport-in-framework-header"
#endif
@import ARKit;
@import CoreGraphics;
@import Foundation;
@import QuartzCore;
@import RealityKit; // Module 'RealityKit' not found
@import UIKit;
#endif
RealUglyDuck
  • 338
  • 2
  • 13
  • Does this answer your question? [Apple framework not found when building Archive](https://stackoverflow.com/questions/58688174/apple-framework-not-found-when-building-archive) – rbaldwin May 13 '20 at 08:39
  • Unfortunately not. I've tried both answers from that post. The problem is that Framework on it's own builds properly as well as project that I want to add Framework to. And even when I import RealityKit directly to new project it works, but when I try importing my Framework I get this error. – RealUglyDuck May 13 '20 at 09:02

2 Answers2

5

After going through all the files that use RealityKit I found what was causing the error. In one of the files I was making extension to ARView to add some custom functionalities and even if I leave it blank like that:

import RealityKit
extension ARView {}

It still gives me "module RealityKit not found" so to walk this around I just created class that makes the same operations as my previous extension and it worked. When I import framework to the project now, it builds without errors.

RealUglyDuck
  • 338
  • 2
  • 13
  • 2
    It's indeed a workaround. What you actually did is disconnecting any dependency between your Pod and RealityKit and by that resolved the issue. The actual problem is that the RealityKit framework doesn't contain the model map file and therefore cannot be imported in Swift project. – Nativ Aug 02 '20 at 09:33
0

RealityKit is not supported in objective-c

user3335999
  • 392
  • 1
  • 2
  • 17