это должно было позволить itemToRefresh = "(Foo!)" для например
let foo: String? = "ABC"
let itemToRefresh = "\(foo!)" // will be -> ABC
// let itemToRefresh = "\(foo)" // will be -> optional(ABC)
// and optional(ABC) will not be equal to ABC
let itemb = "ABC"
print(itemToRefresh) // ABC
print(itemb) // ABC
if itemToRefresh == itemb { // true
print("123") // print 123
}
, если вы хотите, вы можете смело разворачивать необязательное значение и проверить
if (foo != nil) {
let itemToRefresh = "\(foo!)" // will be -> ABC
// let itemToRefresh = "\(foo)" // will be -> "optional(ABC)"
let itemb = "ABC"
print(itemToRefresh)
print(itemb)
if itemToRefresh == itemb {
print("123")
}
}
ли тип данных itemToRefresh и cell.item! .id такое же? –