Ferrite-backup/Ferrite/Extensions/View.swift
kingbri ff35ab7cfa 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-05 18:31:44 -04:00

39 lines
990 B
Swift

//
// View.swift
// Ferrite
//
// Created by Brian Dashore on 8/15/22.
//
import Introspect
import SwiftUI
extension View {
// MARK: Custom introspect functions
func introspectCollectionView(customize: @escaping (UICollectionView) -> Void) -> some View {
inject(UIKitIntrospectionView(
selector: { introspectionView in
guard let viewHost = Introspect.findViewHost(from: introspectionView) else {
return nil
}
return Introspect.previousSibling(containing: UICollectionView.self, from: viewHost)
},
customize: customize
))
}
// MARK: Modifiers
func dynamicAccentColor(_ color: Color) -> some View {
modifier(DynamicAccentColor(color: color))
}
func conditionalId<ID: Hashable>(_ id: ID) -> some View {
modifier(ConditionalId(id: id))
}
func inlinedList() -> some View {
modifier(InlinedList())
}
}