Post

Replies

Boosts

Views

Activity

TipKit Tip popover only shows one time.
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.
1
1
1.2k
Jan ’24
TipKit Rule won't compile
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.
3
1
681
Jan ’24
I broke my Xcode 15 beta
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?
2
0
655
Jun ’23
Safari trunctates base64 string representing an image
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>
1
0
2.1k
Mar ’22
Mac app not receiving notifications consistently
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.
2
0
823
Mar ’20
int64_t field is nil after assigning an enum value
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;
1
0
683
Jan ’20