What happens if you ignore the warning ?
What happens if you import Foundation at top of the file ?
import Foundation not needed if for instance you already import UIKit
Which version of Xcode ? If you use Xcode 26 (with Swift 6.1), you should check in your build settings the MemberImportVisibility flag.
See details here: https://www.hackingwithswift.com/articles/276/whats-new-in-swift-6-1, reading Member import visibility
Topic:
Developer Tools & Services
SubTopic:
Xcode
Tags: