попробуйте это
<input type="checkbox" id="myCheck" onclick="myFunction()">
function myFunction() {
// Get the checkbox
var checkBox = document.getElementById("myCheck");
// Get the output text
var text = document.getElementById("text");
// If the checkbox is checked, display the output text
if (checkBox.checked == true){
text.style.display = "block";
} else {
text.style.display = "none";
}
}
Вы не можете сделать Array<Any>
как Equatable
или Decodable
, потому что оба protocols
будут нуждаться в типе Array's
Element
, чтобы быть Equatable
или Decodable
, и Any
не выполняет это Требование.
Что вы можете сделать, это создать свой собственный заказ class
, чтобы выполнить вышеуказанные требования, как указано ниже,
class MyAny: Equatable, Decodable {
static func == (lhs: MyAny, rhs: MyAny) -> Bool {
return lhs.id == rhs.id
}
var id: Int
}
class Sample: Decodable {
var something: Array<MyAny>?
}