I've a small extension for the Date
type with some simple helper methods like
extension Date
{
func dateByAdding(components: DateComponents) -> Date?
{
return Calendar.current.date(byAdding: components, to: self)
}
Now there's one class where Xcode 13.0 beta 2 keeps telling me Type 'Date' has no member 'dateByAdding'
while in another class the extension works as expected.
All files are 100% swift and all relevant files have a Target Membership of the same target.
I've tried the usual things like removing the Derived Data folder, but without success. Any ideas what could cause this?
The following screenshot shows the error:
It's just the following line of code:
let date = Date().dateByAdding(components: DateComponents(month: -6))
This seems to be an issue with Xcode 12 beta 2. I opened the project in Xcode 12.5.1 and was able to use the methods in the Date
Extension without any problem and compile the project.
Now back in Xcode 13 beta 2 the Date
Extension is found in this class and I can use the methods from it.