Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
//
// ContentView.swift
// CombinedUI
//
// Created by Adolfo Vera Blasco on 14/06/2019.
// Copyright © 2019 desappstre.com. All rights reserved.
//
import SwiftUI
import Foundation
import CombinedUIKit
struct ContentView : View
{
/// El modelo de datos
@ObjectBinding private var operatingSystems: OperatingSystemStore
var body: some View
{
VStack
{
ForEach(operatingSystems.systems) { system in
HStack
{
Text(system.name)
.font(.title)
.fontWeight(.black)
.foregroundColor(.primary)
Text(system.version)
.font(.headline)
.fontWeight(.semibold)
.foregroundColor(.secondary)
}
}
Button(action: self.handleAddButtonTap) {
Text("Añadir otro sistema operativo")
}
.padding(32)
}
}
// MARK: - Actions -
private func handleAddButtonTap() -> Void
{
let highSierra = OperatingSystemStore.OperatingSystem(named: "High Sierra", version: "10.13")
self.operatingSystems.add(highSierra)
}
}
#if DEBUG
struct ContentView_Previews : PreviewProvider {
static var previews: some View
{
let store = OperatingSystemStore()
return ContentView(operatingSystems: store)
}
}
#endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.