Swift 5
Swift – create grouped and inset grouped lists
May 9, 2021
0

//  MainView.swift

//  MySwiftLearning1

//

//  Created by Arifur Rahman Jerin on 4/30/21.

//

import SwiftUI

struct Pizzeria: View {

    let name: String

    var body: some View {

        Text(“Restaurant: \(name))

    }

}

struct MainView: View {

    var body: some View {

        List {

            Section(header: Text(“Examples”)) {

            Pizzeria(name: “Joe’s Original”)

            Pizzeria(name: “The Real Joe’s Original”)

            Pizzeria(name: “Original Joe’s”)

            }

        }

        .listStyle(GroupedListStyle())

        }

}

 

 

//  MainView.swift

//  MySwiftLearning1

//

//  Created by Arifur Rahman Jerin on 4/30/21.

//

import SwiftUI

struct Pizzeria: View {

    let name: String

    var body: some View {

        Text(“Restaurant: \(name))

    }

}

struct MainView: View {

    var body: some View {

       List {

            Section(header: Text(“Examples”)) {

            Pizzeria(name: “Joe’s Original”)

            Pizzeria(name: “The Real Joe’s Original”)

            Pizzeria(name: “Original Joe’s”)

            }

        }

.listStyle(InsetGroupedListStyle())

        }

}

About author

ZERIN

CEO & Founder (BdBooking.com - Online Hotel Booking System), CEO & Founder (TaskGum.com - Task Managment Software), CEO & Founder (InnKeyPro.com - Hotel ERP), Software Engineer & Solution Architect

Swift – Add Sections to List

struct Pizzeria: View {     let name: String   ...

Read more

Swift – How to let users delete rows from a list

struct MainView: View {   @State private var user...

Read more

Swift – Carousel Lists on watchOS

List(1..<51) { Text("\($0)") } .listStyle(Carou...

Read more

There are 0 comments

Leave a Reply

Your email address will not be published. Required fields are marked *