Post

Replies

Boosts

Views

Activity

Reply to UIViewControllerTransitionCoordinator cannot coordinate view controller presentation animations along-side UIPropertyAnimator based animators
Still running into this today. It looks like this is fixed as of iOS 11.3, so to support older versions, I have this method in my UIPresentationController subclass: internal func animateDimmingViewDisappearing() {     guard let dimmingView = dimmingView,         let transitionCoordinator = presentedViewController             .transitionCoordinator         else { return }     // Despite this API being available earlier, iOS 11.3 is the first OS     // that doesn’t just animate this instantly.     if #available(iOS 11.3, *) {         transitionCoordinator.animateAlongsideTransition(             in: dimmingView.superview,             animation: { _ in dimmingView.alpha = 0 },             completion: { _ in dimmingView.removeFromSuperview() }         )     } else {         UIView.beginAnimations("animateDimmingViewDisappearing",                                context: nil)         if transitionCoordinator.transitionDuration > 0 {             UIView.setAnimationDuration(                 transitionCoordinator.transitionDuration             )         }         else {             UIView.setAnimationDuration(1.0 / 3.0)         }         UIView.setAnimationCurve(transitionCoordinator.completionCurve)         dimmingView.alpha = 0         UIView.commitAnimations()     } }
Jul ’20
Reply to Launching Unix tools from command-line apps
OK, more progress. This works—apparently I just wasn’t letting the task live long enough:let url = URL(fileURLWithPath: "/bin/echo") do { let task = try NSUserUnixTask(url: url) task.standardOutput = FileHandle(forWritingAtPath: "/Users/jeff/Desktop/test") task.execute(withArguments: ["test"]) { error in if let error = error { fatalError(error.localizedDescription) } print("Hello") exit(0) } } catch { fatalError(error.localizedDescription) } dispatchMain()
Jan ’20
Reply to Launching Unix tools from command-line apps
I’ve also tried using NSUserUnixTask, but this seems to quit immediately:let url = URL(fileURLWithPath: "/bin/echo") do { let task = try NSUserUnixTask(url: url) task.standardOutput = FileHandle(forWritingAtPath: "/Users/jeff/Desktop/test") task.execute(withArguments: ["test"]) { error in if let error = error { fatalError(error.localizedDescription) } print("Hello") } } catch { fatalError(error.localizedDescription) }My print statement never prints, and the file is not written. If I create the file, it does not receive any contents.
Jan ’20
Reply to Launching Unix tools from command-line apps
Thanks for the reply. You’re right, I’m using xcrun to launch simctl. Here’s a simple example of how I’m trying to launch the process, from a Swift command-line utility. The app sandbox is not in the Signing & Capabilities section of Xcode, and there are no entitlements:import Foundation let process = Process() process.arguments = ["/bin/echo", "Hello, World!"] process.launch() process.waitUntilExit()This generates the above error about reading from that location.
Jan ’20
Reply to Zombie IOSurface Objects with SwiftUI and ImageIO
I think I figured it out. In the callback for the animation frame, I’m setting an image property to an Image struct with the CGImage I get from ImageIO. As you scroll, if a row comes back into view that had a cached CGImage from this animation block, and the animation has since been stopped, then accessing it crashed. So, setting the image property back to nil when I stop the animation fixed the issue.
Dec ’19
Reply to Zombie IOSurface Objects with SwiftUI and ImageIO
Also, if it helps, I’m getting some output in the Xcode console while this happens:0000000A: 0100 4 4 128 00000016: 0101 4 4 128 00000022: 0102 3 6 110 0000002E: 011A 5 8 116 0000003A: 011B 5 8 124 00000046: 0128 3 2 2 00000052: 0131 2 12 132 0000005E: 0132 2 20 144 000000A6: 0100 4 4 256 000000B2: 0101 4 4 256 000000BE: 0102 3 6 266 000000CA: 0103 3 2 6 000000D6: 0106 3 2 6 000000E2: 0115 3 2 3 000000EE: 0201 4 4 272 000000FA: 0202 4 4 3957 0000000A: 0100 4 4 128 00000016: 0101 4 4 128 00000022: 0102 3 6 110 0000002E: 011A 5 8 116 0000003A: 011B 5 8 124 00000046: 0128 3 2 2 00000052: 0131 2 12 132 0000005E: 0132 2 20 144 000000A6: 0100 4 4 256 000000B2: 0101 4 4 256 000000BE: 0102 3 6 266 000000CA: 0103 3 2 6 000000D6: 0106 3 2 6 000000E2: 0115 3 2 3 000000EE: 0201 4 4 272 000000FA: 0202 4 4 3957
Dec ’19