2022-01-20

filter multiple conditions on array in swift 5

I need to apply below filter combination on array of struct.

enter image description here

var students:[Student]? - on this student array need to apply combination of these filters using swift. User can select only Name or both Name and location and so on ..mulitple combinations.

Really not sure ... how to implement this.

Struct Student {
    Var fName: String
    Var lname: String
    Var class: String
    Var pincode: Int
    Var active: Bool
    Var location: Address
}

struct Address {
    Var street1: String
    Var street2:String
    Var country:String
}

Suppose we need to filter based on

  • Name (fname only)
  • Active
  • location ( street1 only bydefault )


from Recent Questions - Stack Overflow https://ift.tt/32ielCe
https://ift.tt/3tFyInY

No comments:

Post a Comment