Im using Swift 3
Wondering whether any method is available to check if all the properties in an object has value / nil
Eg:
class Vehicle { v
If you have a lot of fields, you can use this approach:
struct S { let x: String? let y: Int let z: Bool func hasNilField() -> Bool { return ([x, y, z] as [Any?]).contains(where: { $0 == nil}) } }