Nextcloud Login refactoring
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
//
|
||||
// ListVStack.swift
|
||||
// Nextcloud Cookbook iOS Client
|
||||
//
|
||||
// Created by Vincent Meilinger on 29.05.25.
|
||||
//
|
||||
import SwiftUI
|
||||
|
||||
struct ListVStack<Element, HeaderContent: View, RowContent: View>: View {
|
||||
@Binding var items: [Element]
|
||||
let header: () -> HeaderContent
|
||||
let rows: (Int, Binding<Element>) -> RowContent
|
||||
|
||||
init(_ items: Binding<[Element]>, header: @escaping () -> HeaderContent, rows: @escaping (Int, Binding<Element>) -> RowContent) {
|
||||
self._items = items
|
||||
self.header = header
|
||||
self.rows = rows
|
||||
}
|
||||
|
||||
var body: some View {
|
||||
VStack(alignment: .leading) {
|
||||
header()
|
||||
.padding(.horizontal, 30)
|
||||
VStack(alignment: .leading, spacing: 0) {
|
||||
ForEach(items.indices, id: \.self) { index in
|
||||
rows(index, $items[index])
|
||||
.padding(10)
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
.padding(4)
|
||||
.background(Color.secondary.opacity(0.1))
|
||||
.clipShape(RoundedRectangle(cornerRadius: 15))
|
||||
.padding(.horizontal)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user