Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save filsv/6c5afc686f49ac7c2fcfa063fb1f2ac0 to your computer and use it in GitHub Desktop.
Save filsv/6c5afc686f49ac7c2fcfa063fb1f2ac0 to your computer and use it in GitHub Desktop.
// 'App' is ambiguous for type lookup in this context - Error and how to fix it:
import SwiftUI
import RealmSwift
// MARK: - Issue
@main
struct MyApp: App { // <- 'App' is ambiguous for type lookup in this context
init() {
// Configure Realm
}
var body: some Scene {
WindowGroup {
InitialView()
}
}
}
// MARK: - Fix
@main
struct MyApp: SwiftUI.App { // Simply add "SwiftUI." before App
init() {
// Configure Realm
}
var body: some Scene {
WindowGroup {
InitialView()
}
}
}
// Note: Realm using 'App' in its framework modules as well SwiftUI, so just needed to specify which one needed to import and issue will dissapear
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment