One Choice at a Time

Sometimes people take things from us that we’ll never get back. Sometimes experiences alter us so deeply that the trajectory of our entire life changes in an instant. Sometimes we crack so far open…

Smartphone

独家优惠奖金 100% 高达 1 BTC + 180 免费旋转




Feedback from various pull requests

If you have nils that you want to filter out of arrays, use compactMap. This checks if the element is nil. If it is nil, it ignores it. If it’s not nil, it goes through the completion block and does something with the element.

Replace this code:

With this code:

Closures

The following two code blocks are the same. This is where the argument isNew is a Bool. I don’t think you can do option 2 shorthand if the argument is not a Bool.

I don’t quite understand Option 2 though. The point is that nil evaluates to false. However I don’t want to pass in false as an argument if the parameter is nil. I want it to exit and not call submit.

I think that perhaps the first self? fails and exits if it’s nil, so it never gets to checking the self?.isNew in that instance. But I haven’t played around with it in debugger so it feels a bit less clear compared to option 1 to me.

Add a comment

Related posts:

Youtube Down Again?

Youtube is the world’s largest video website and it is owned by Google. Lately there has been a few issues with the app, questioning its efficiency. According to The Guardian in the comments section…

Chapter 1

Welcome to Schitte Behind.. “Chapter 1” is published by Schitte Industries.

Endangered whales need more protection. So do their rescuers.

The humpback whale was so severely entangled in fishing gear off California’s North Coast that it couldn’t move and was in danger of drowning. But rescuers couldn’t help because the National Oceanic…