Closed grosch closed 3 years ago
Here's a minimal example showing it.
I create a new app, added a content extension, added your package, and it builds fine. Then edit NotificationViewController.swift to create a TimelineView
and the errors appear.
Thanks for reporting it, I'll look into it. Does it work well when used with CocoaPods?
Another data point as I keep playing. If I access it from the primary app target it's fine. So it appears to be something to do with accessing it from the other target specifically. I've seen issues reported where SPM fails when new targets are added later, and I explicitly made sure that all the targets were created before I added your package.
I would assume it would still work OK with cocoapods as that's how it was originally done. This seems to be specific to SPM, which I definitely want to use, as I'm updating the Push Notifications book from raywenderlich.com to be current.
What's the Xcode version you're using? Are there going to be some CalendarKit Ray Wenderlich tutorials?
Version 12.2 beta 2 (12B5025f)
Tutorials, no. But in my Push Notifications book, in chapter 12 where I show a "real world" full example, it uses CalendarKit to handle showing the calendar in the push notification itself.
Thanks for the info. I was able to find the sample, looks good! Never thought this is mentioned in a book. I'd appreciate a copy if possible just to keep it.
Also, if you wish I might review the way CK is used in the book to see if something could be improved.
Overall, could you please triangulate the root cause of this problem, more precisely, is it an Xcode BETA issue or a CK issue?
Chuckle, you just don't remember. I bugged the crap out of you a few years ago figuring out how to make this work. It only does cause you pointed me at the timeline stuff :) I'd love to have you review how it works though. Might be better ways now. The complete code is in the NotificationViewController.txt attachment I did when opening the issue.
It's seems to be explicitly a bug with how SPM is working with CK. I found a bunch of articles saying if you remove the dead code stripping it'll work, but that's not fixing it, and is also bad for SwiftUI projects as it depends on that for removing all the preview related code.
I do remember. On the surface, your code looks correct, without any significant issues.
This might be related to referencing DateTools, although I'm not sure about it. Are you including the library into the project?
Also, build fails for me in the attached example
When I include CK it automatically adds DateToolsSwift as a dependency as well. I did try and explicitly add that one as an import but it made no difference.
Oh, and I asked the publisher about getting you a copy of the book.
Thank you. Okay, could this be related to the latest pull request? #277 We could just wait for the Xcode 12.2 to go out of beta and use CocoaPods right now. The problem is likely to resolve itself.
Nope. However, I found a workaround. I realized I'm only using your package in the other target, so I delete and re-added your package but this time noticed that I can pick which target to add as a dependency, so I picked the content extension and now I'm good.
As to the book...If you give me your email address the publisher will get you hooked up with a book.
Ok, so just to be clear: the issue is resolved now and everything works as expected. My email is topchiy@protonmail.ch
Yes, the issue is resolved and had nothing to do with your package.
New Issue Checklist
Issue Description
I'm using a new SwiftUI app to update my existing project. The only place I use CalendarKit is in the notification content extension, which is still UIKit. I added your library via SPM and made sure to point at the master branch. I'm using the exact same code as the original version used. The only difference is that one was done via CocoaPods and this one is of course using Swift Package Manager.
As soon as I use something like TimelineView I'm getting tons of errors.
Code I'm using with CalendarKit
That line, for example, will result in these errors:
Undefined symbol: type metadata accessor for CalendarKit.TimelineView Undefined symbol: CalendarKit.TimelineView.__allocating_init() -> CalendarKit.TimelineView
NotificationViewController.txt