Resolve the issue ‘App is ambiguous for type’ with Realm in your SwiftUI project

I recently realized that there is a problem while integrating realm into swift. The problem was caused by Dependency Name Collision. Let’s solve it in 3 seconds.

Dependency Name Collision Example


This is the problem I recently found. When you use Realm, compilation error occurs with “‘App’ is ambiguous for type lookup in this context”.

The origin of the problem

Realm is using `App` name
Your SwiftUI App is using `App` name

This is because RealmSwift is using App and clearly your SwiftUi app is also using App protocol. How do I resolve this issue?

Issue Solved

Issue Solved with `SwiftUI.App`

By specifying that you are importing App from SwiftUI, this issue can be easily resolved!


  • Realm uses App in its module and SwiftUI uses App in its module. It causes ambiguous type error.
  • Just by specifying you’re importing App from SwiftUI, this issue can go away for good in a second.



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
KD Knowledge Diet

Software Engineer, Mobile Developer living in Seoul. I hate people using difficult words. Why not using simple words? Keep It Simple Stupid!