diff --git a/PersianSwear.swift b/PersianSwear.swift index 7bffc94..2b1be2d 100644 --- a/PersianSwear.swift +++ b/PersianSwear.swift @@ -1,18 +1,18 @@ import Foundation final class PersianSwear { - private typealias Words = HashSet + private typealias Words = Set static let shared = PersianSwear(words: []) - private(set) var words: Words = HashSet() + private(set) var words: Words = hSet() - init(words: Words = HashSet()) { + init(words: Words = Set()) { self.words = words } convenience init(words: [String] = []) { - self.init(words: HashSet(words)) + self.init(words: Set(words)) } func loadWords(using loader: PersianSwearDataLoader, completion: @escaping (Result) -> Void) { @@ -38,7 +38,7 @@ final class PersianSwear { } func addWords(_ words: [String]) { - addWords(HashSet(words)) + addWords(Set(words)) } func removeWord(_ word: String) { @@ -50,7 +50,7 @@ final class PersianSwear { } func removeWords(_ words: [String]) { - removeWords(HashSet(words)) + removeWords(Set(words)) } func isBadWord(_ word: String) -> Bool { @@ -103,7 +103,7 @@ class GithubPersianSwearDataLoader: PersianSwearDataLoader { do { let model = try JSONDecoder().decode(Model.self, from: data) - completion(.success(HashSet(model.word))) + completion(.success(Set(model.word))) } catch { completion(.failure(error)) }