Post

Replies

Boosts

Views

Activity

Reply to Please clarify Combine Demand usage
Claude, I'm writing my own Publisher, Subscriber, and Subscriptions. Most everyone uses infinite demands so my questions don't apply, I really want to understand actual usage and with no demo code from Apple using it, no way to know.I recently wrote a small article on Combine, and there are a slew of them on the web, and each has a different take on the topic. So many are wrong, and it would just be great to get this clarified.
Apr ’20
Reply to How to use NWPathMonitor to assess overall network state?
Turns out the NWPath has an array of interfaces ("availableInterfaces)", they are hashable. So one can keep an array of interfaces and their state.That said, I did testing with my phone, turning WIFI and Cellular on and off, singly or together, to see when the block gets called. Based on that, I determine:1) the status of the last block is the overall status (satisfied or not)2 the last status message of "satisfied" returns the expensive state of the overall networking path: if the system believes it can use WIFI, then its false. If the only option is cellular, then its expensive.In other words, if you turn cellular on, then wifi, then wifi off, the last status message references cellular and expensive is set.
Jan ’20
Reply to Why does unwrapping an optional func change its signature?
I understand optional protocols. The compiler knows its optional, that's why "delegate.stream" cannot be called directly.I correctly guessed that I could add a "?" and use this "delegate.stream?(fetcher, handle: .openCompleted)", which compiles just fine.Then it occurred to me - why not try to get the function as its own variable, assuming it exists, with "let stream = delegate.stream" in the guard statement. That works fine.But when I go to use this function, I get a warning that the "handle:" parameter should not be there. It is this error I don' understand.
Jan ’20
Reply to NavigationLinks only work once?
Experiencing the same thing on the Simulator. What is interesting is that if you alternate - select the first row, go back, select the second row, go back, then you can select the first row again. The issue is that you cannot select the same row again.Is there a bug report on this?
Jan ’20
Reply to AVPlayerLooper fails when there is a AVVideoComposition
OK - never fails now if there is no filtering?!?! But if I add a filter (either of the two), then it fails at the next loop: let videoComposition = AVVideoComposition(asset: asset, applyingCIFiltersWithHandler: { request in var outputImage = request.sourceImage defer { request.finish(with: outputImage, context: nil) } do { var angle = self.hueAngle let radians = degrees2radians(angle) angle = (angle + 1) % 360 self.hueAngle = angle self.hueFilter.angle = radians self.hueFilter.inputImage = outputImage outputImage = self.hueFilter.outputImage! } do { var radius = self.radius let inc = self.inc radius += inc if radius > 5 { radius = 5 self.inc *= -1 } if radius < 0 { radius = 0 self.inc *= -1 } self.radius = radius self.blurFilter.radius = radius self.blurFilter.inputImage = outputImage outputImage = self.blurFilter.outputImage! } })Obviously validating the composition makes something better in the composition object.
Dec ’19
Reply to AVPlayerLooper fails when there is a AVVideoComposition
Now I'm really pulling my hair out. I added this test to be 100% sure the video was properly constructed:let ret = videoComposition.isValid(for: asset, timeRange: timeRange, validationDelegate: self) print("VALIDATE", ret)All possible delegate calls implemented with print statemens - but it returns true and I got no delegate calls. But now, the looper is not failing! Sixteen loops so far and still going strong (will leave it on!). Grrrrr
Dec ’19