Implementing search functionality iOS app

I have an iOS app with nested TableView controllers. The data to populate the tables is present like this:

struct Item {
var firstAttribute : String = ""
var secondAttribute : String
var thirdAttribute : Bool
var fourthAttribute : Bool
}

let firstItem = [
Item(firstAttribute: "attribute text", secondAttribute: "more text", thirdAttribute: false, fourthAttribute: true),
]
let secondItem = [
Item(firstAttribute: "attribute text", secondAttribute: "more text", thirdAttribute: false, fourthAttribute: true),
]

Why have I done it like that? Because it worked and I'm learning as I go along. Now, I would like to add a functionality to search the entire app and display matching attribute texts.

I want to avoid having to change the way I store this table data. How would I go about addressing and processing ALL the variables containing the "text", in order to filter for matching search results?

Terms of Service

Privacy Policy

Cookie Policy