DaisukeNagata / SwiftUI2.0

3 stars 0 forks source link

LazyVGrid #4

Open DaisukeNagata opened 4 years ago

DaisukeNagata commented 4 years ago

https://developer.apple.com/documentation/swiftui/lazyvgrid

スクリーンショット 2020-06-28 10 00 12
DaisukeNagata commented 4 years ago
import SwiftUI

struct ContentView: View {
    var columns: [GridItem] =
             Array(repeating: .init(.flexible()), count: 2)
    var body: some View {
        ScrollView {
             LazyVGrid(columns: columns) {
                 ForEach((0...3), id: \.self) {
                     let codepoint = $0 + 0x1f600
                     let emoji = String(Character(UnicodeScalar(codepoint)!))
                     Text("\(emoji)")

                 }
             }.font(.largeTitle)
         }
    }
}

struct ContentView_Previews: PreviewProvider {
    static var previews: some View {
        ContentView()
    }
}