Skip to content

Commit c52ce6d

Browse files
committed
Refactor AnyLocalizationDataSource to remove unnecessary accessQueue and simplify method implementations
1 parent e78a689 commit c52ce6d

File tree

1 file changed

+3
-21
lines changed

1 file changed

+3
-21
lines changed

Sources/CrowdinSDK/CrowdinSDK/Localization/Provider/LocalizationDataSource.swift

Lines changed: 3 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ protocol LocalizationDataSourceProtocol {
1717
class AnyLocalizationDataSource<T>: LocalizationDataSourceProtocol {
1818
typealias Values = T
1919

20-
private let accessQueue = DispatchQueue(label: "com.crowdin.AnyLocalizationDataSource.accessQueue", attributes: .concurrent)
21-
2220
private let _findKey: (String) -> String?
2321
private let _findValues: (String, String) -> [Any]?
2422
private let _update: (T) -> Void
@@ -29,27 +27,11 @@ class AnyLocalizationDataSource<T>: LocalizationDataSourceProtocol {
2927
self._update = dataSource.update
3028
}
3129

32-
func findKey(for string: String) -> String? {
33-
var result: String?
34-
accessQueue.sync {
35-
result = _findKey(string)
36-
}
37-
return result
38-
}
30+
func findKey(for string: String) -> String? { _findKey(string) }
3931

40-
func findValues(for string: String, with format: String) -> [Any]? {
41-
var result: [Any]?
42-
accessQueue.sync {
43-
result = _findValues(string, format)
44-
}
45-
return result
46-
}
32+
func findValues(for string: String, with format: String) -> [Any]? { _findValues(string, format) }
4733

48-
func update(with values: T) {
49-
accessQueue.async(flags: .barrier) {
50-
self._update(values)
51-
}
52-
}
34+
func update(with values: T) { _update(values) }
5335
}
5436

5537
class StringsLocalizationDataSource: LocalizationDataSourceProtocol {

0 commit comments

Comments
 (0)