Swift Package Module Name conflicting with types defined in other modules

Swift Package Module name conflicting with struct, class or any type defined in other Modules.
created Swift Package Module with name OSLogBoolFormat and then I have to import os in the code. when I try to access types defined in OSLogBoolFormat module it's not being recognized and its only pointing to os.OSLogBoolFormat .

Code Example: GitHub - sreexamus/NewOneTest: SwiftPackage with type of other module

import UIKit;
import os;
import OSLogBoolFormat;

class ViewController: UIViewController {

    override func viewDidLoad() {
        super.viewDidLoad()
        // Do any additional setup after loading the view.
        let name = OSLogBoolFormat.PrcoessKT.name
        print(name)

    }
}

This arises from the same problem as that reported in the longstanding bug SR-898, which has been reported many times since then.

One option to disambiguate is to import os in a separate file and create a new typealias for os.OSLogBoolFormat, then to refer to the type in the rest of your project using only that typealias without importing os.

Terms of Service

Privacy Policy

Cookie Policy