Search
 
SCRIPT & CODE EXAMPLE
 

SWIFT

how to center vertically scrollview swiftui

/// Custom vertical scroll view with centered content vertically
///
struct VScrollView<Content>: View where Content: View {
  @ViewBuilder let content: Content
  
  var body: some View {
    GeometryReader { geometry in
      ScrollView(.vertical) {
        content
          .frame(width: geometry.size.width)
          .frame(minHeight: geometry.size.height)
      }
    }
  }
}
Comment

PREVIOUS NEXT
Code Example
Swift :: debounce in swift 
Swift :: Create a Swift Array 
Swift :: Swift Class and Objects 
Swift :: uibutton swift set title 
Swift :: parse int in swift 
Swift :: Swift "Hello, World!" Program 
Swift :: swift create custom button with icon programmatically 
Swift :: swift ui view 
Swift :: variable sum in swift 
Swift :: SwiftCSV and RealmSwift library 
Swift :: swift 5 touchupinsideview 
Swift :: Swift Add/Remove Elements From Tuple 
Swift :: Customize indicator view iOS swift 
Swift :: Swift Autoclosure 
Swift :: swift 5 progress bar height 
Swift :: Swift Nested Ternary Operators 
Swift :: Rules for naming Swift Variables 
Swift :: swift constants 
Swift :: change button image tint color swift 
Swift :: xib image shown on simulator but not on device 
Swift :: add placeholder to code snippets xcode 
Swift :: no module like realmswift 
Swift :: swift 5 macos close app 
Swift :: swift uicollectionview reloaddata completion 
Ruby :: base64 decode ruby 
Ruby :: ruby reorder keys in hash 
Ruby :: rails routes grep 
Ruby :: add references rails migration 
Ruby :: length validation rails 
Ruby :: ruby if 
ADD CONTENT
Topic
Content
Source link
Name
3+7 =