associated-value Questions
3
Solved
I have this enum:
enum Animal {
case cat(CatModel)
case dog(DogModel)
}
And an array of animals:
var animals: [Animal]
I need to find a Cat object in this array by a property that Dog doesn't ...
Ptomaine asked 20/8, 2020 at 22:33
6
Solved
I have an enum of associated values which I would like to make equatable for testing purposes, but do not know how this pattern would work with an enum case with more than one argument.
For exampl...
Wehner asked 12/7, 2018 at 7:52
4
Solved
Suppose I have an enum case with an associated value, and two variables of that enum type:
enum MyEnum {
case foo, bar(_ prop: Int)
}
let var1 = MyEnum.foo
let var2 = MyEnum.bar(1)
If I want t...
Truax asked 4/12, 2018 at 21:18
1
© 2022 - 2024 — McMap. All rights reserved.