Ferrite/Ferrite/Views/CommonViews/InlinedList.swift
kingbri 8306ca1f9b Ferrite: Clean up UI changes
- Migrate the empty view to a common view which vertically centers
itself to the screen's bounds

- Don't initialize underlying state variables in init as this is
discouraged behavior. Instead, hook the source list editor to an ID
that refreshes when an existing source list URL has been set

Signed-off-by: kingbri <bdashore3@proton.me>
2022-09-07 09:51:01 -04:00

28 lines
766 B
Swift

//
// InlinedList.swift
// Ferrite
//
// Created by Brian Dashore on 9/4/22.
//
// Removes the top padding on lists for iOS 16
// Use UITableView.appearance().contentInset.top = -20 for iOS 15 and below in the App file
//
import Introspect
import SwiftUI
struct InlinedList: ViewModifier {
func body(content: Content) -> some View {
if #available(iOS 16, *) {
content
.introspectCollectionView { collectionView in
collectionView.contentInset.top = -20
}
} else {
content
.introspectTableView { tableView in
tableView.tableHeaderView = UIView(frame: CGRect(x: 0, y: 0, width: 0, height: 20))
}
}
}
}