Skip to content

Instantly share code, notes, and snippets.

View azamsharp's full-sized avatar

Mohammad Azam azamsharp

View GitHub Profile
app.post("books") { req -> Book in
let book = try req.content.decode(Book.self)
return book
}
func routes(_ app: Application) throws {
app.get("books") { req -> [Book] in
let books = [Book(name: "Atomic Habits", isbn: "1234"), Book(name: "Peek Performance", isbn: "3456"), Book(name: "How Not to Die", isbn: "6567")]
return books
}
}
//
// ContentView.swift
// Shared
//
// Created by Mohammad Azam on 6/30/20.
//
import SwiftUI
struct ListItem: Identifiable {
//
// ContentView.swift
// Shared
//
// Created by Mohammad Azam on 6/30/20.
//
import SwiftUI
struct Category: Identifiable {
//
// ContentView.swift
// Shared
//
// Created by Mohammad Azam on 6/27/20.
//
import SwiftUI
func headerView(_ index: Int) -> some View {
Section {
Text("Section \(index)")
.padding()
.foregroundColor(Color.white)
.font(.title)
.frame(maxWidth: .infinity)
.background(Color.blue)
}
}
NavigationView {
ScrollView {
LazyVGrid(columns: columns, spacing: 10, pinnedViews: [.sectionHeaders]) {
ForEach(1..<11) { index in
Section(header: headerView(index)) {
ForEach(0..<20) { _ in
Rectangle()
var columns: [GridItem] = [
GridItem(.flexible()),
GridItem(.flexible()),
GridItem(.flexible())
]
var columns: [GridItem] = [
GridItem(.adaptive(minimum: 100))
]
var columns: [GridItem] = [
GridItem(.flexible()),
GridItem(.flexible()),
GridItem(.flexible()),
GridItem(.flexible()),
GridItem(.flexible())
]