Ferrite-backup/Ferrite/Views/CommonViews/ConditionalId.swift
kingbri 16a39c3a58 Ferrite: Properly inline lists
The inset grouped list style has a top inset that adds extra space
between the navigation bar title and the list rows. Use introspect
to remove this space on UITableView and UICollectionView (for iOS 16).

Sections completely ignore the introspect changes, so add a section
header which removes the list row insets.

Signed-off-by: kingbri <bdashore3@proton.me>
2022-09-05 12:47:32 -04:00

24 lines
452 B
Swift

//
// ConditionalId.swift
// Ferrite
//
// Created by Brian Dashore on 9/4/22.
//
// Only applies an ID for below iOS 16
// This is due to ID workarounds making iOS 16 apps crash
//
import SwiftUI
struct ConditionalId<ID: Hashable>: ViewModifier {
let id: ID
func body(content: Content) -> some View {
if #available(iOS 16, *) {
content
} else {
content
.id(id)
}
}
}