SwiftUI_visionOS_Note

ToDo List

May 15, 2024
0 min read|
struct ListView: View {
	var body: some View {
		List {
			ListRowView(title: "This is the first title!")
		}
	}
}
swift

struct ListRowView: View {
	
	let title: String
	
	var body: some View {
		HStack {
			Image(systemName: "checkmark.circle")
			Text(title)
			Spacer
		}
	}
}
swift

struct ListView: View {

	@State var items: [String] = [
		"This is the first titel!",
		"This is the second titel!",
		"This is the third titel!"

	]
	var body: some View {
		List {
			ForEach(items, id: \.self) { item in
				ListRowView(title: item)
			}
		}
	}
}
swift

import Foundation

struct ItemModel: Identifiable {
	let id: String = UUID().uuidString
	let title: String
	let isCompleted: Bool
}
swift

@State var items: [ItemModel] = [
	ItemModel(title: ",,,", isCompleted: false)
	ItemModel(title: ",,,", isCompleted: false)
	ItemModel(title: ",,,", isCompleted: false)
]
swift

Subscribe to our newsletter

Get the latest news and updates from our team