Post

Replies

Boosts

Views

Activity

Reply to Trouble with iOS App Planning
When is user score updated ? When player plays (then he/she's not in background) ; the ranking may change, not the score. in other cases ? Is that a correct understanding ? Did you consider: keeping leaderboard on your server and update it there pushing notification when score / ranking change reload from server when user returns from background, in case he/she missed notification
Topic: Programming Languages SubTopic: Swift Tags:
Aug ’21
Reply to safe area - not understanding what I am seeing
I then embedded a tab controller and added a few more storyboards. I suppose you mean some more ViewControllers, not storyboards. One storyboard not connected yet. Which VC is not connected yet ? It is pretty hard to understand your description. What do we see in viewSafe1 and viewSafe2: the storyboard or the HMI on device or simulator ? What is the original storyboard I guess you mean original VC. But you should name them precisely: tabBarController First tab connected to a NavController, the NavController connects to FermentationController viewSafe1 is the bottom of NavController. Exact ? Are there other VC in the navigation ? Second tab connects to HELP VC What is viewSafe2 showing ? Could you show the complete storyboard so that we can understand all the links between VC ? PS: it is easy to attach images here:
Topic: UI Frameworks SubTopic: UIKit Tags:
Aug ’21
Reply to NSTreeController insertObject Failing
Effectively, video suggests that: first time, no selectionIndexPath : hence indexpath set at top second time, selection is first node, hence, indexpath set to 1 and after, insertObject fails, so it edits the current selection Could you test theIndexPath, just before calling [self insertObject:theTreeNode atArrangedObjectIndexPath:theIndexPath]; Could you also print the nodes count before and after insert ? Doc for insertObject says: Set the clearsFilterPredicateOnInsertion to YES to allow insertion. Could you try ? And to make sure you're on similar conditions, could you ask her to upgrade to 11.5.2 ?
Topic: UI Frameworks SubTopic: AppKit Tags:
Aug ’21
Reply to How to stop an animation
You can do this (I added print to see what's happening: @IBAction func startAnimation(_ sender: NSButton) { NSAnimationContext.runAnimationGroup({ (context) in print("Start", view1.alphaValue) context.duration = 5.0 view1.animator().alphaValue = 0 print("End", view1.alphaValue) }) { // Completion print("Completed", self.view1.alphaValue) self.view1.alphaValue = 1.0 // You may need to reset at the end ? } } @IBAction func stopAnimation(_ sender: NSButton) { print("Stop") view1.layer?.removeAllAnimations() } When you stop, animation ends immediately and completion handler is called. Hope that helps.
Topic: Programming Languages SubTopic: Swift Tags:
Aug ’21
Reply to How to stop an animation
I want to click stop/pause and the animation stop at that point, at some % between 0 and 1 alphaValue I have not found a direct way to do it. But here is a workaround. At start of animation: get the alphaValue: initAlpha get the time In the completion, if elapsed is less than the set duration (here 5.0), which means animation was stopped: compute elapsedTime since beginning of animation compute what should be alpha at this time, if "normal" endValue (0) is endAlpha and normalDuration (5.0): let deltaAlpha = (initAlpha - endAlpha) * (elapsed / normalDuration) and set alpha inaccordingly: self.view1.alphaValue = initAlpha - deltaAlpha Full code should look like this: @IBAction func startAnimation(_ sender: NSButton) { let initAlpha = self.view1.alphaValue // Usually 1.0 let endAlpha = CGFloat(0) let startTime = DispatchTime.now() // Precisely when animation starts let fixedDuration = 5.0 var elapsedTime : Double = 0.0 NSAnimationContext.runAnimationGroup({ (context) in context.duration = fixedDuration // 5.0 self.view1.animator().alphaValue = endAlpha // 0 }) { // Completion let endTime = DispatchTime.now() elapsedTime = Double((endTime.uptimeNanoseconds - startTime.uptimeNanoseconds)) / 1_000_000_000 // Difference in seconds if elapsedTime >= fixedDuration { self.view1.alphaValue = initAlpha // return to initial value 1.0 } else { // Adjust proportionally let deltaAlpha = (initAlpha - endAlpha) * (elapsedTime / fixedDuration) self.view1.alphaValue = initAlpha - deltaAlpha } } }
Topic: Programming Languages SubTopic: Swift Tags:
Aug ’21
Reply to IP packet class in Swift
Swift class for IP packets That's pretty vague spec ! V4 or V6 ? Do you just want to display or have other func in the class ? Here is for Python (I didn't look in details), maybe you can adapt: https://github.com/mike01/pypacker Full spec is in RFC791. have a look, really complex to cover all cases. https://datatracker.ietf.org/doc/html/rfc791
Topic: Programming Languages SubTopic: Swift Tags:
Aug ’21
Reply to How to fix "appleaccountd quit unexpectedly" error?
It occurs also when leaving simulator or when leaving XCode, with simulator remaining open. Crash also occurs when working with playground, no use of simulator. Even without quitting XCode Launch XCode13ß4 (or XCode13ß5) Run app in simulator Stop app from XCode Quit Simulator Crash occurs a few seconds later. I filed a bug report : Aug 7, 2021 at 10:26 AM – FB9464093
Aug ’21
Reply to Barcode Scanner and write to Excel
You should read this old thread, which confirms what I told you: writing directly to an Excel file is overly complex. Not advised to try… https://developer.apple.com/forums/thread/23656 However, here is a parser https://github.com/CoreOffice/CoreXLSX or code to modify an empty file https://stackoverflow.com/questions/40403322/writing-data-from-tableview-to-excel-using-swift
Aug ’21