I am trying to convert the following Java code into swift, but I do not know about this data structure new (int start, int end)[input. length]
, any guidance would be appraciated.
public override void collection_entries(int[] input)
{
var ranges = new (int start, int end)[input.length];
}
CodePudding user response:
In swift, you should use a Range()
.
let start = 0
let end = 6
var ranges = Range(start...end)[input.count]