my-files-sample/Modules/Sources/Profile/UI/Components/ClearBackgroundList.swift

49 lines
1.0 KiB
Swift
Raw Normal View History

//
// ClearBackgroundList.swift
// Profile
//
// Created by Javier Cicchelli on 03/12/2022.
// Copyright © 2022 Röck+Cöde. All rights reserved.
//
import SwiftUI
struct ClearBackgroundList<Content>: View where Content: View {
// MARK: Properties
@ViewBuilder let content: Content
// MARK: Body
var body: some View {
if #available(iOS 16.0, *) {
List{
content
}
.scrollContentBackground(.hidden)
.scrollIndicators(.hidden)
} else {
List {
content
}
.onAppear {
UITableView.appearance().backgroundColor = .clear
UITableView.appearance().showsVerticalScrollIndicator = false
}
}
}
}
// MARK: - Previews
struct ClearBackgroundList_Previews: PreviewProvider {
static var previews: some View {
ClearBackgroundList {
Text("Something...")
}
.background(Color.red)
}
}