Quantcast
Channel: User Burhanuddin Sunelwala - Stack Overflow
Viewing all articles
Browse latest Browse all 36

ArrayType in extension where clause

$
0
0

enter image description here

extension Array where Element: _ArrayType, Element.Generator.Element: Any {    func transpose() -> [Element] {        if self.isEmpty { return [Element]() }        let count = self[0].count        var out = [Element](repeating: Element(), count: count)        for outer in self {            for (index, inner) in outer.enumerated() {                out[index].append(inner)            }        }        return out    }}

I am getting this error in Swift 3.0 after converting it from Swift 2.2. The elements of the array are also array. So how to define it in Swift 3.0?


Viewing all articles
Browse latest Browse all 36

Trending Articles





<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>