We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent b2c94cc commit c283112Copy full SHA for c283112
ios/MullvadSettings/CustomListRepository.swift
@@ -39,11 +39,11 @@ public struct CustomListRepository: CustomListRepositoryProtocol {
39
public func save(list: CustomList) throws {
40
var lists = fetchAll()
41
42
- if let index = lists.firstIndex(where: { $0.id == list.id }) {
+ if lists.contains(where: { $0.name.localizedCaseInsensitiveCompare(list.name) == .orderedSame }) {
43
+ throw CustomRelayListError.duplicateName
44
+ } else if let index = lists.firstIndex(where: { $0.id == list.id }) {
45
lists[index] = list
46
try write(lists)
- } else if lists.contains(where: { $0.name == list.name }) {
- throw CustomRelayListError.duplicateName
47
} else {
48
lists.append(list)
49
0 commit comments