How to be DRY on ranges and closed ranges?


(Jenus Dong) #1

Yes, it is so inconvenient to use that CloseRange isn’t the special of Range. But according to your case, CountableRange can be used in the condition. And ClosedCountableRange and CountableRange is available to converting. Refer: https://oleb.net/blog/2016/09/swift-3-ranges/