Unwrap icon indicating copy to clipboard operation
Unwrap copied to clipboard

Free Coding exercises not consistent

Open aagd opened this issue 4 years ago • 1 comments

Some questions allow the creation of an empty array with var array:[String] = [], while some would need var array:[String] = [String]() to be valid.

aagd avatar Sep 22 '20 11:09 aagd

This is solved by code - see Unwrap/Extensions/String-Variables.swift (line 102) https://github.com/twostraws/Unwrap/blob/main/Unwrap/Extensions/String-Variables.swift

// If folks use explicit type annotation for a collection backed up by an empty initializer, prefer removing the annotation.

replaced = replaced.replacingOccurrences(of: #":\[([A-Za-z]+)\] *= *\[\]"#, with: " = [$1]()", options: .regularExpression)

Carrione avatar Oct 18 '20 23:10 Carrione