The overall UI of Ferrite has been changed to make animations smoother and streamline the experiences. A new search filter interface has been added for all iOS versions, but iOS 15 and up have smooth UI applied due to bugs with searchbars in iOS 14 (which shouldn't even have a searchbar in the first place). Also fix the plugin fetching logic to not listen to a combine publisher and instead use a notification that is easier to control. Signed-off-by: kingbri <bdashore3@proton.me>
37 lines
1 KiB
Swift
37 lines
1 KiB
Swift
//
|
|
// SearchableContent.swift
|
|
// Ferrite
|
|
//
|
|
// Created by Brian Dashore on 2/11/23.
|
|
//
|
|
// View to link animations together with searchbar
|
|
// Passes through geometry proxy and last height vars for any comparison
|
|
//
|
|
|
|
import SwiftUI
|
|
|
|
struct SearchableContent<Content: View>: View {
|
|
@Binding var searching: Bool
|
|
|
|
@State private var lastHeight: CGFloat = 0.0
|
|
|
|
@ViewBuilder var content: (Bool) -> Content
|
|
|
|
var body: some View {
|
|
GeometryReader { geom in
|
|
// Return if the height has changed as a closure variable for child transactions
|
|
content(geom.size.height != lastHeight)
|
|
.backport.onAppear {
|
|
lastHeight = geom.size.height
|
|
}
|
|
.onChange(of: geom.size.height) { newHeight in
|
|
lastHeight = newHeight
|
|
}
|
|
.transaction {
|
|
if geom.size.height != lastHeight && searching {
|
|
$0.animation = .default.speed(2)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|