This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Modified from https://swiftuirecipes.com/blog/pull-to-refresh-with-swiftui-scrollview | |
struct OffsetAwareScrollView<Content>: View where Content: View { | |
typealias OffsetReceiver = (CGFloat) -> Void | |
let axes: Axis.Set | |
let showsIndicators: Bool | |
let offsetReceiver: OffsetReceiver | |
let content: Content | |
init(_ axes: Axis.Set = .vertical, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import SwiftUI | |
// Adapted from: https://stackoverflow.com/questions/62102647/swiftui-hstack-with-wrap-and-dynamic-height/62103264#62103264 | |
struct WrappingHStack<Model, V>: View where Model: Hashable, V: View { | |
typealias ViewGenerator = (Model) -> V | |
var models: [Model] | |
var viewGenerator: ViewGenerator | |
var horizontalSpacing: CGFloat = 2 | |
var verticalSpacing: CGFloat = 0 |