malcommac / SwiftDate

🐔 Toolkit to parse, validate, manipulate, compare and display dates, time & timezones in Swift.
MIT License
7.64k stars 770 forks source link

Suggest renaming `SwiftDate` struct to `SwiftDateConfig` or similar to disambiguate module from struct #814

Open mitchins opened 1 year ago

mitchins commented 1 year ago

As per the Xcode warning:

Public struct 'SwiftDate.SwiftDate' shadows module 'SwiftDate', which may cause failures when importing 'SwiftDate' or its clients in some configurations; please rename either the struct 'SwiftDate.SwiftDate' or the module 'SwiftDate', or see https://github.com/apple/swift/issues/56573 for workarounds

When compiling from source, it generally may not cause an issue, but when trying to distribute the module as a pre-compiled .xcframework, it will cause issues in the import.

It seems like a mostly cosmetic thing, but having a class or struct the same name as a module can cause issues like this, so it would seem best to avoid it by choosing another name like SwiftDateConfig or anything really.

I'd be happy to do the work if it's blessed and there's a name that's chosen.

Having done a quick check in the 6.3.1 release (due to iOS 12 constraints currently) it seems fairly sane.

image

Additionally SwiftDate.defaultRegion -> SwiftDateConfig.defaultRegion SwiftDate.autoFormats -> SwiftDateConfig.autoFormats