List Item Component
The list item Component is a reusable view that allows you to create customisable list with different items, such as simple button, switch, radio buttonItems an array, button and image icon. List items are versatile UI elements commonly used for displaying cell with different list.
Features
- Create text and title list, text and title list with image icon, text and title list with simple buttons, text and title list with radio buttons, buttonItems an array, text and title list with toggle switch.
- Customise titles, captions, icons, and appearance.
- Interact with list item using buttons.
Installation
-
Copy the
OCListItem
component folder into your Xcode project. -
Use the
OCListItemView
view in your SwiftUI code:
import SwiftUI
struct ContentView: View {
var body: some View {
VStack {
OCListItem(title: "Text", caption: "Caption", showCaptionFirst: false, alignment: .center)
OCListItem(title: "Text", caption: "Caption", showCaptionFirst: false, alignment: .center, leadingView: {
Image.iconImage
}, trailingView: {
EmptyView()
})
}
}
}