jonasman / TeslaSwift

Swift library to access the Tesla API
MIT License
243 stars 72 forks source link

Need Vehicle type alias to avoid conflicts with client Vehicle type #141

Closed JetForMe closed 1 year ago

JetForMe commented 1 year ago

If client code defines a Vehicle type, then it becomes impossible to distinguish between a TeslaSwift.Vehicle and a Client.Vehicle.

Adding typealias TeslaSwiftVehicle = Vehicle to your library should alleviate this.

Alternatively, change the name of either the library or the TeslaSwift class.

jonasman commented 1 year ago

My suggestion is to rename the type in the client code or just use TeslaSwift.Vehicle when needed

JetForMe commented 1 year ago

You can't use TeslaSwift.Vehicle because Swift finds the TeslaSwift class, not the module. There's a way to alias module names when building a Package.swift project, but this doesn't work for an Xcode project.

And asking the client to change their class type is not really tenable either. The fix is literally one line, but it has to be in your library.