ApplebaumIan/SwiftUI-Apple-Watch-Decimal-Pad

#error("This is a watchOS only library.")

Closed this issue ยท 9 comments

I have add the library into my Xcode project which have both watch and Mobile App. Watch App is build on SwiftUI while Mobile App is build on StoryBoard. Now when I tried to compile the project with preview its showing this error. But with run option is working.

@Taimoor20 what version of Xcode are you running and could you possibly provide an example project or the project itself?

Also make sure you dont include the package with your storyboard app target

I've run into this as well. I think you could safely drop the error calls as everything is behind os(watchOS) checks. Another factor might be that in all of your @available declarations you specify iOS 13. Dropping those might help this issue as well.

Yes, I have the same issue

Okay I will expedite this issue. Currently I'm not running the latest version of Xcode... ๐Ÿ˜… I will be able to fix this in the near future but if anyone can open a PR faster than me it's probably a good first issue!

@stanlemon I will take a look at this asap! My only question is when taking away the code the checks whether the library is being run in watchOS or not Will Swift package index still catalog the package as a watchOS package? This was my only reason for adding those exceptions. That and the fact that I was using some watchOS specific features, such as haptic feedback.

I think it should work. Check out this package https://github.com/freyaalminde/watch-date-picker/blob/main/Sources/WatchDatePicker/DatePicker.swift

Note no use of #error. We could add the unavailable for the @available tag for the other platforms.

I think it should work. Check out this package https://github.com/freyaalminde/watch-date-picker/blob/main/Sources/WatchDatePicker/DatePicker.swift

Note no use of #error. We could add the unavailable for the @available tag for the other platforms.

I like the idea of using @available tags. Especially if it will fix the build failure issue!