Remove Duplicates in Array - custom extension to avoid using set

extension Array where Element: Hashable {
    func removingDuplicates() -> [Element] {
        var addedDict = [Element: Bool]()

        return filter {
            addedDict.updateValue(true, forKey: $0) == nil
        }
    }

    mutating func removeDuplicates() {
        self = self.removingDuplicates()
    }
}

updateValue documentation

updateValue(:forKey:)

return value: The value that was replaced, or nil if a new key-value pair was added