From f7294a84f6ec9248cf8ef3fee120f5f9a90651d0 Mon Sep 17 00:00:00 2001 From: Chris Vanderloo Date: Sat, 6 Jun 2020 15:35:29 -0400 Subject: [PATCH] Added CardView, modified NavigationView layout --- tidbits.xcodeproj/project.pbxproj | 4 ++++ tidbits/CardView.swift | 27 +++++++++++++++++++++++++++ tidbits/ContentView.swift | 25 +++++++++++++------------ 3 files changed, 44 insertions(+), 12 deletions(-) create mode 100644 tidbits/CardView.swift diff --git a/tidbits.xcodeproj/project.pbxproj b/tidbits.xcodeproj/project.pbxproj index f5fa868..45e6d5d 100644 --- a/tidbits.xcodeproj/project.pbxproj +++ b/tidbits.xcodeproj/project.pbxproj @@ -16,6 +16,7 @@ 83460783248B2491006EBD71 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 83460781248B2491006EBD71 /* LaunchScreen.storyboard */; }; 8346078E248B2492006EBD71 /* tidbitsTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8346078D248B2492006EBD71 /* tidbitsTests.swift */; }; 83460799248B2492006EBD71 /* tidbitsUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 83460798248B2492006EBD71 /* tidbitsUITests.swift */; }; + 83987CBD248C25D000BA9FFE /* CardView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 83987CBC248C25D000BA9FFE /* CardView.swift */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -51,6 +52,7 @@ 83460794248B2492006EBD71 /* tidbitsUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = tidbitsUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 83460798248B2492006EBD71 /* tidbitsUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = tidbitsUITests.swift; sourceTree = ""; }; 8346079A248B2492006EBD71 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 83987CBC248C25D000BA9FFE /* CardView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CardView.swift; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -103,6 +105,7 @@ children = ( 83460773248B248F006EBD71 /* AppDelegate.swift */, 83460775248B248F006EBD71 /* SceneDelegate.swift */, + 83987CBC248C25D000BA9FFE /* CardView.swift */, 8346077A248B248F006EBD71 /* ContentView.swift */, 8346077C248B2491006EBD71 /* Assets.xcassets */, 83460781248B2491006EBD71 /* LaunchScreen.storyboard */, @@ -274,6 +277,7 @@ 83460776248B248F006EBD71 /* SceneDelegate.swift in Sources */, 8346077B248B248F006EBD71 /* ContentView.swift in Sources */, 83460779248B248F006EBD71 /* tidbits.xcdatamodeld in Sources */, + 83987CBD248C25D000BA9FFE /* CardView.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/tidbits/CardView.swift b/tidbits/CardView.swift new file mode 100644 index 0000000..9dc7fd0 --- /dev/null +++ b/tidbits/CardView.swift @@ -0,0 +1,27 @@ +// +// CardView.swift +// tidbits +// +// Created by Chris Vanderloo on 6/6/20. +// Copyright © 2020 Chris Vanderloo. All rights reserved. +// + +import Foundation +import SwiftUI + +struct CardView: View { + var a: Int? + init() { } + init(a: Int) { self.a = a } + var body: some View { + Group { + Text("Hello, World!") + } + } +} + +struct CardView_Previews: PreviewProvider { + static var previews: some View { + CardView() + } +} diff --git a/tidbits/ContentView.swift b/tidbits/ContentView.swift index e901d00..d26f220 100644 --- a/tidbits/ContentView.swift +++ b/tidbits/ContentView.swift @@ -10,21 +10,22 @@ import SwiftUI struct ContentView: View { var body: some View { - VStack { - ScrollView { - List { - Text("Hello, World!") + NavigationView { + VStack { + ScrollView { + VStack { + CardView(a: 1) + } } - } - HStack { - Spacer() - Button(action: { }) { - Circle() + HStack { + Spacer() + Button(action: { }) { + Circle() + } + .padding([.bottom, .trailing]) + .frame(width: 88, height: 88) } - .padding([.bottom, .trailing]) - .frame(width: 88, height: 88) } - } } } -- 2.51.2