Post

Replies

Boosts

Views

Activity

Reply to C-Style for statement has been removed in swift 3
If I make it as close to c-style as possible. I can convert the code as the followings: for var i: CGFloat = start; i <= stop; i += step { //c-style for statement has been removed in swift3 x1 = self.x.scale(i) + x.axis.inset path.move(to: CGPoint(x: x1, y: y1)) path.addLine(to: CGPoint(x: x1, y: y2)) } -> in Swift5.5 as of Oct 23, 2021. for i in sequence(first:start, next:{ (($0-step)<=stop) ? $0+step:nil }) { x1 = self.x.scale(i) + x.axis.inset path.move(to: CGPoint(x: x1, y: y1)) path.addLine(to: CGPoint(x: x1, y: y2)) } I hope this helps.
Oct ’21
Reply to Revisiting the recommendations from WWDC 2017-706 regarding GCD queue hierarchies.
Hey, I'm a game developer (engineer, artist both) who can answer this properly. But what matters is that I have little time to do this. sorry for this. I think the WWDC video has almost all we need to understand GCD only when we're fully versed in using GCD. Fortunately due to the heavy workload of game development over many years and thanks to God Jesus and His Father, I grabbed fully what is all about GCD and how to use Dispatch framework effectively. Without further ado, right into the key answer: The target queue is mainly used for reducing 'context switches and resource contention'. It is a great thing for GCD! Without it, thread will explode by overwhelming dispatch queues you may be going to create the complex problem in the game. That's all. It is not that difficult to understand. However, to use it properly, you should understand all of GCD, Dispatch framework. For example, My game is currently using 31 dispatch queues with the help of target queues. You can also avoid context switches and resource contention without using those 'target queues' if you use semaphore as well. But dispatch queue is better in efficiency, even if it would be more finicky to use. 'Artificial Intelligence' plus 'tons of animations' employed in the game is the source of this complexity. I hope this may help. My site is 'SungW.net' which I can NOT update properly due to lack of time. However, if you have more questions, you may contact me through this.
Nov ’20