Skip to content

Instantly share code, notes, and snippets.

View karthironald's full-sized avatar
👨‍💻
Learning.

Karthick Selvaraj karthironald

👨‍💻
Learning.
  • @mallow technologies private limited
  • Karur
View GitHub Profile
final class MenuData: ObservableObject {
@Published var menu: [MenuSection] = [] // Will make an announcement when an item is added or remove from this menu array
}
final class MenuData: ObservableObject {
@Published var menu: [MenuSection] = [] // Will make an announcement when an item is added or remove from this menu array
}
struct ContentView: View {
@ObservedObject var menuData: MenuData = MenuData() // Listener added to receive data changed announcements to refresh the List inside body.
var body: some View {
List(menuData.menu) { menu in
Text(menu.name)
// recommended
@State private var name: String = ""
// Not recommended. But it will work though.
@State var name: String = ""
//
// ContentView.swift
// SUImagePickerView
//
// Created by Karthick Selvaraj on 02/05/20.
// Copyright © 2020 Karthick Selvaraj. All rights reserved.
//
import SwiftUI
struct ContentView: View {
//
// SUImagePickerView.swift
// SUImagePickerView
//
// Created by Karthick Selvaraj on 02/05/20.
// Copyright © 2020 Karthick Selvaraj. All rights reserved.
//
import SwiftUI
import UIKit
import SwiftUI
struct ContentView: View {
let products = ["iPhone", "iPad", "iMac", "MacBook", "Watch", "AppleTv"]
@State private var shouldShowSlider = false
@State private var size: CGFloat = 20.0
var body: some View {
NavigationView {