Hi,
You might want to check this article: https://www.hackingwithswift.com/quick-start/swiftui/how-to-add-a-search-bar-to-filter-your-data
A more correct way to do what you want to achieve would be to create a struct or class representing a medicine, and then an array containing the actual medicines that you want to display. Then, you would create your list by iterating over this array. And you could display the search results in this list, like the article explains it.
Hope it helps!
Topic:
UI Frameworks
SubTopic:
SwiftUI
Tags: