try Tips.resetDatastore()
try Tips.configure(
[
// Reset which tips have been shown and what parameters have been tracked, useful during testing and for this sample project
.datastoreLocation(.applicationDefault),
// When should the tips be presented? If you use .immediate, they'll all be presented whenever a screen with a tip appears.
// You can adjust this on per tip level as well
.displayFrequency(.immediate)
]
)
struct UserTip: Tip {
static let hoverEvent: Event = Event(id: "hoverEvent")
@Parameter var isHovering: Bool = false
static var tipCountKey = "UserTipCount"
var title: Text
var message: Text?
var image: Image?
var tipShownLimit: Int
var options: [Option] {
// Show this tip 5 times.
[
Tips.MaxDisplayCount(5),
Tips.IgnoresDisplayFrequency(true)
]
}
var rules: [Rule] {
#Rule($isHovering) {
$0 == true
}
}
}
struct ShowPopoverTip: View {
@State private var tip = UserTip(
title: Text("the title"),
message: Text("the message here"),
image: Image(systemName: "volleyball.fill"),
tipShownLimit: 10
)
var body: some View {
Button(action: {
}) {
Text("Hover over me")
}
.popoverTip(tip)
.onAppear {
}
.onHover { hovering in
if hovering {
tip.isHovering = true
print("tip.status: \(tip.status)")
print("tip.isHovering: \(tip.isHovering)")
print("tip.shouldDisplay: \(tip.shouldDisplay)")
}else{
tip.isHovering = false
print("tip.isHovering: \(tip.isHovering)")
}
}
}
}
The popover only works once, even though I have set it to Tips.MaxDisplayCount(5)
Either the Tip is getting invalidated or popovers only show once.
debug output:
tip.isHovering: true
tip.shouldDisplay: false
tip.isHovering: false
tip.status: pending
tip.isHovering: true
tip.shouldDisplay: false
tip.isHovering: false
btw, if I remove the Tips.resetDatastore(), it still shows once each time I launch the app.
Post
Replies
Boosts
Views
Activity
static let hoverEvent: Event = Event(id: "hoverEvent")
/// Parameters-Rules
@Parameter
static var isHovering: Bool = false
static var tipCountKey = "UserTipCount"
var title: Text
var message: Text?
var image: Image?
var tipShownLimit: Int
@ObservedObject var buttonState: ButtonState
var rules: [Rule] {
#Rule(Self.hoverEvent) {
$0.donations.count < tipShownLimit
}
}
}
error: Event Rules require a count comparison.
If I replace tipShownLimit like this:
var rules: [Rule] {
#Rule(Self.hoverEvent) {
$0.donations.count < 3
}
}
it compiles fine. the error is: Event Rules require a count comparison.
I successfully downloaded the beta and it ran fine with a new project for visionOS, just the Hello World. So, today I thought I would see if I could run my 20-year-old iPad app, which I haven't touched since then. I tried to get it running, but I was getting errors that I couldn't figure out. Eventually, I got an internal error asking me to submit a report, which I did. I looked at the logs and tried to figure out how to get it running, making changes here and there. Eventually I broke Xcode, so I uninstalled it using CleanMyMacX and redownloaded it and tried to reinstall it. This time it didn't ask for permission to access the Downloads folder. I created a new project, but keep getting an error about failing to get RealityKit. I uninstalled it again and am downloading again. Does anyone know what I might be doing wrong?
I am writing a web server and testing with Safari. The server is written in Go. I have a page which allows the user to upload an image. The image displays properly in Safari. The image data is in a base64 string. This is on an input tag in the HTML. The save button submits this image along with other inputs. If the string length is over about 500K, when the request arrives at the server, the image string has been truncated which then produces an error EOF when attempting to decode the image. I have used the web inspector to see if I can find an issue there, but everything appears normal. If I select an image of less than around 500K, it is shown fine in the browser and the data string is fine when it arrives at the server. The image upload is accomplished by an input button of type "file" which onchange() executes this javascript code:
function processFile(imageInput) {
const reader = new FileReader()
reader.addEventListener("load", () => {
uploaded_image = reader.result;
let displayImage = document.querySelector("#display_image");
displayImage.style.backgroundImage = `url(${uploaded_image})`;
document.querySelector("#display_image_data").value = uploaded_image;
document.querySelector("#display_image_size").innerHTML = uploaded_image.length.toString();
});
reader.readAsDataURL(imageInput.files[0]);
}
The display_image_data element is
<input id = "display_image_data" name = "photoBytesString" hidden>
I use cloudkit notifications to keep my 3 macs in synch when changes occur in cloudkit. Yesterday, 2 of the 3 macs did not receive notifications while 1 did receive. All Macs are running the latest Catalina, 10.15.3. Today, with no code changes, 1 of the 3 macs is not receiving notifications, even after rebooting. But one is receiving that didn't receive yesterday.didRegisterForRemoteNotificationsWithDeviceToken is successful on all 3 Macs.OK, just rebooted the failing Mac again and it is now receiving notifications. Now I am just concerned about the robustness of using the notifications.
I have an app which uses in-app purchases. I created 3 subscriptions of the type: non-renewing subscription. However, after purchasing a 1-month subscription, I purchase again and it says already purchased so this is free. Why is that?
I have implemented in-app purchases; however, in attempting to test it, I keep getting this error when making a purchase:Your Apple ID has been locked for security reasons.I have created 5 different testers and get this error on all of them. I have tried doing the unlock, changing passwords, but I still get the same error.
Entity: ContactRecord@property (nonatomic) int64_t contactType;enum contactType{ contactTypeCustomer = 0, contactTypeVendor = 1, contactTypeRestaurantTableSupplier = 2, contactTypeReclaimedWoodSupplier = 3, contactTypeHardwoodFlooringSupplier = 4};enum contactType contactType = (enum contactType)[[CoreDataManager sharedManager]contactTypeFromString:contactTypeString];self.currentContactRecord.contactType = contactType;