Skip to content

Commit 96e28ce

Browse files
author
Mithun
committed
Navigation and Passing Data
1 parent 084a243 commit 96e28ce

File tree

3 files changed

+71
-13
lines changed

3 files changed

+71
-13
lines changed

DesignCode.xcodeproj/project.pbxproj

+4
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
AB62172722D870540039BC73 /* Home.swift in Sources */ = {isa = PBXBuildFile; fileRef = AB62172622D870540039BC73 /* Home.swift */; };
1212
ABB215DC22DB353800424B38 /* BlurView.swift in Sources */ = {isa = PBXBuildFile; fileRef = ABB215DB22DB353800424B38 /* BlurView.swift */; };
1313
ABB215DE22DB713300424B38 /* UpdateList.swift in Sources */ = {isa = PBXBuildFile; fileRef = ABB215DD22DB713300424B38 /* UpdateList.swift */; };
14+
ABB215E022DB7F4700424B38 /* UpdateDetail.swift in Sources */ = {isa = PBXBuildFile; fileRef = ABB215DF22DB7F4700424B38 /* UpdateDetail.swift */; };
1415
ABE07CBF22D74F5700D209BE /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = ABE07CBE22D74F5700D209BE /* AppDelegate.swift */; };
1516
ABE07CC122D74F5700D209BE /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = ABE07CC022D74F5700D209BE /* SceneDelegate.swift */; };
1617
ABE07CC322D74F5700D209BE /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = ABE07CC222D74F5700D209BE /* ContentView.swift */; };
@@ -24,6 +25,7 @@
2425
AB62172622D870540039BC73 /* Home.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Home.swift; sourceTree = "<group>"; };
2526
ABB215DB22DB353800424B38 /* BlurView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BlurView.swift; sourceTree = "<group>"; };
2627
ABB215DD22DB713300424B38 /* UpdateList.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UpdateList.swift; sourceTree = "<group>"; };
28+
ABB215DF22DB7F4700424B38 /* UpdateDetail.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UpdateDetail.swift; sourceTree = "<group>"; };
2729
ABE07CBB22D74F5700D209BE /* DesignCode.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = DesignCode.app; sourceTree = BUILT_PRODUCTS_DIR; };
2830
ABE07CBE22D74F5700D209BE /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
2931
ABE07CC022D74F5700D209BE /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = "<group>"; };
@@ -69,6 +71,7 @@
6971
ABE07CC222D74F5700D209BE /* ContentView.swift */,
7072
AB62172622D870540039BC73 /* Home.swift */,
7173
ABB215DD22DB713300424B38 /* UpdateList.swift */,
74+
ABB215DF22DB7F4700424B38 /* UpdateDetail.swift */,
7275
AB1D3B1B22D9CDEF00D0AEA6 /* HomeList.swift */,
7376
ABB215DB22DB353800424B38 /* BlurView.swift */,
7477
ABE07CC422D74F5900D209BE /* Assets.xcassets */,
@@ -161,6 +164,7 @@
161164
ABE07CBF22D74F5700D209BE /* AppDelegate.swift in Sources */,
162165
ABB215DE22DB713300424B38 /* UpdateList.swift in Sources */,
163166
AB1D3B1C22D9CDEF00D0AEA6 /* HomeList.swift in Sources */,
167+
ABB215E022DB7F4700424B38 /* UpdateDetail.swift in Sources */,
164168
ABE07CC122D74F5700D209BE /* SceneDelegate.swift in Sources */,
165169
AB62172722D870540039BC73 /* Home.swift in Sources */,
166170
ABE07CC322D74F5700D209BE /* ContentView.swift in Sources */,

DesignCode/UpdateDetail.swift

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
//
2+
// UpdateDetail.swift
3+
// DesignCode
4+
//
5+
// Created by Mithun x on 7/14/19.
6+
// Copyright © 2019 Mithun. All rights reserved.
7+
//
8+
9+
import SwiftUI
10+
11+
struct UpdateDetail: View {
12+
13+
var title = "SwiftUI"
14+
var text = "Loading..."
15+
var image = "Illustration1"
16+
17+
var body: some View {
18+
VStack(spacing: 20.0) {
19+
Text(title)
20+
.font(.largeTitle)
21+
.fontWeight(.heavy)
22+
23+
Image(image)
24+
.resizable()
25+
.aspectRatio(contentMode: .fit)
26+
.frame(height: 200)
27+
28+
Text(text)
29+
.lineLimit(nil)
30+
.frame(minWidth: 0, maxWidth: .infinity, alignment: .leading)
31+
32+
Spacer()
33+
}
34+
.padding(30.0)
35+
}
36+
}
37+
38+
#if DEBUG
39+
struct UpdateDetail_Previews: PreviewProvider {
40+
static var previews: some View {
41+
UpdateDetail()
42+
}
43+
}
44+
#endif

DesignCode/UpdateList.swift

+23-13
Original file line numberDiff line numberDiff line change
@@ -15,23 +15,33 @@ struct UpdateList: View {
1515
var body: some View {
1616
NavigationView {
1717
List(updates) { item in
18-
NavigationLink(destination: Text("w2")) {
19-
VStack(alignment: .leading) {
20-
Text(item.title)
21-
.font(.headline)
18+
NavigationLink(destination: UpdateDetail(title: item.title, text: item.text, image: item.image)) {
19+
HStack(spacing: 12.0) {
20+
Image(item.image)
21+
.resizable()
22+
.aspectRatio(contentMode: .fit)
23+
.frame(width: 80, height: 80)
24+
.background(Color("background"))
25+
.cornerRadius(20)
2226

23-
Text(item.text)
24-
.lineLimit(2)
25-
.lineSpacing(4)
26-
.frame(height: 50.0)
27-
.font(.subheadline)
27+
VStack(alignment: .leading) {
28+
Text(item.title)
29+
.font(.headline)
2830

29-
Text(item.date)
30-
.font(.caption)
31-
.fontWeight(.bold)
32-
.color(.gray)
31+
Text(item.text)
32+
.lineLimit(2)
33+
.lineSpacing(4)
34+
.frame(height: 50.0)
35+
.font(.subheadline)
36+
37+
Text(item.date)
38+
.font(.caption)
39+
.fontWeight(.bold)
40+
.color(.gray)
41+
}
3342
}
3443
}
44+
.padding(.vertical, 8.0)
3545
}
3646
.navigationBarTitle(Text("Updates"))
3747
.navigationBarItems(trailing:

0 commit comments

Comments
 (0)