I managed to do that by using `map` as I didn't find the equivalence.

files.forEach {

    var indices = IndexSet()



    for index in 0 ..< subtitleFiles.count {

        if $0.sn == subtitleFiles[index].sn {

            indices.insert(index)

        }

    }



    let subtitles = indices.map { return subtitleFiles[$0] } // get array
at IndexSet

    videoSubtitles.updateValue(subtitles, forKey: $0)

    indices.reversed().forEach { subtitleFiles.remove(at: $0) } // remove
elements at IndexSet

}


Is there a better way to do that?


Zhaoxin
_______________________________________________
swift-users mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-users

Reply via email to