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
// https://github.com/siteline/SwiftUI-Introspect | |
import Introspect | |
struct ScrollViewOffsetModifier: ViewModifier { | |
@Binding | |
var scrollViewOffset: CGFloat | |
private let scrollViewDelegate: ScrollViewDelegate? | |
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
// Assumes usage of: | |
// - https://gist.github.com/LePips/3640ad0cd9b6e2ceb407e9d0e9e32b5c | |
// - https://gist.github.com/LePips/5c6b4546e9bd8f91c029f705347be974 | |
// | |
// Last gist not required, but nice to have for headers. | |
struct BackgroundParallaxHeaderModifier<Header: View>: ViewModifier { | |
@Binding | |
var scrollViewOffset: CGFloat |
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
// Use to create an Array of elements in a result builder | |
// | |
// Best used with a typealias: | |
// typealias StringBuilder = ArrayBuilder<String> | |
@resultBuilder | |
public struct ArrayBuilder<Element> { | |
public static func buildBlock(_ components: [Element]...) -> [Element] { | |
components.flatMap { $0 } |