I have a tip that's supposed to be shown after a certain event:
extension Tips {
static let somethingHappened = Tip.Event(id: "somethingHappened")
}
struct TestTip: Tip {
let title = Text("Test tip")
let message = Text("This is a description")
var rules: [Rule] {
#Rule(Tips.somethingHappened) { $0.donations.count > 0 }
}
}
I would like to present this tip when its status becomes .available. To do this, I'm observing statusUpdates in a task:
tipStatusObserverTask = Task { [tip, weak self] in
print("observing \(tip.id)")
for await status in tip.statusUpdates {
guard let self, !Task.isCancelled else {
return
}
print("tip status: \(status)")
if case .available = status {
print("will present \(tip.id)")
displayTip()
}
}
print("done observing \(tip.id)")
}
then I'm donating the event on a button press:
@objc func didPressButton() {
Tips.somethingHappened.sendDonation {
print("donated Tips.somethingHappened")
}
}
The event is donated, but statusUpdates doesn't fire, so the tip never gets shown. The tip appears after I restart the app. What's happening? What am I doing wrong?
statusUpdates fires just fine if the rule is based on a @Parameter change, so I would expect this approach to work for event-based rules.
Here's a project that reproduces the issue in case anyone wants to try: https://www.icloud.com/iclouddrive/085FxcgTPStDSSPoXwh7dx1pQ#TipKitTest
Post
Replies
Boosts
Views
Activity
I'm working on a project with several dozen targets and a Swift macro. Due to the purpose of the macro (generating Codable boilerplate), pretty much all targets depend on it. The project is generated with XcodeGen.
Since upgrading to 16.1 (I think), Xcode has basically turned into a glorified TextEdit for me: refactoring, symbol navigation and search don't work. Also, I'm getting a lot of ghost errors that keep popping up hours after I fix them, while at the same time new build errors never show up in the error navigator, so I have to check the build log to see why the build failed.
I noticed that project indexing is taking a very long time. As a troubleshooting step, I tried deleting DerivedData (which afaik includes the index) to see if this fixes the problem. Xcode started indexing the project from scratch, and if the progress indicator is to be trusted, After ~40 minutes it's only about 1/3 done. For every target Xcode seems to be spending a lot of time indexing SwiftOperators, SwiftDiagnostics, SwiftParser. I'm assuming these are related to the macro.
Does anyone else have this problem? Unfortunately, I can't confirm this is caused by the macro, removing it from the project and seeing if this fixes the issue seems infeasible.
I'm trying out the pull request review workflow in Xcode 15.4. Pressing the Approve button approves the pull request, but also adds a comment: "'APPROVE' performed by Xcode." I don't see anything in the settings that would allow me to remove or change this comment, am I missing something? Is there some obscure user defaults key for this comment or is it hardcoded?
As a side note, who thought this was a good idea? This reminds me of the "Sent from my iPhone" signature added by the Mail app. I understand that people working on Xcode are proud of their product, but this just comes off as tacky.