stephencelis / SQLite.swift

A type-safe, Swift-language layer over SQLite3.
MIT License
9.64k stars 1.56k forks source link

'View' is ambiguous for type lookup in this contex #980

Closed digitxo closed 3 years ago

digitxo commented 4 years ago

When I import SQLite to my SwiftUI controller I get this msg:

image

pwightman commented 4 years ago

Both SwiftUI and SQLite have a View type, so the compiler is confused about which one to use. You either need to not import SQLite and SwiftUI in the same file, or be explicit and put SwiftUI.View anywhere it’s supposed to be a View from SwiftUI. I would personally recommend not putting your SQLite code in the same file as your SwiftUI code.

adam0x01 commented 3 years ago

My workaround is to put the SQLite related codes to a new separated swift file, then invoke func directly in your main SwiftUI file.