krz/daybyday

iOS learning games for young children: days, months, seasons, numbers, letters, animals and more. education ios kids swift https://krz.sh/apps/daybyday/

DayByDay/CenteredScrollView.swift

main
daybyday/DayByDay/CenteredScrollView.swift history · blame · raw

21 lines · 520 bytes

1 symbol in this file
 1//
 2//  CenteredScrollView.swift
 3//  DayByDay
 4//
 5
 6import SwiftUI
 7
 8/// Centers its content, and scrolls it when it is taller than the screen, as
 9/// it can be at the accessibility text sizes.
10struct CenteredScrollView<Content: View>: View {
11    @ViewBuilder let content: Content
12
13    var body: some View {
14        GeometryReader { geo in
15            ScrollView {
16                content.frame(maxWidth: .infinity, minHeight: geo.size.height)
17            }
18            .scrollBounceBehavior(.basedOnSize)
19        }
20    }
21}