Skip to content

Commit aed362e

Browse files
UNT-T11872 add example list in content view
1 parent f98f23d commit aed362e

File tree

6 files changed

+142
-3
lines changed

6 files changed

+142
-3
lines changed

SSSwiftUIAnimations/SSSwiftUIAnimations.xcodeproj/project.pbxproj

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,16 @@
1111
2BC2D8F528CF3A6F00CAB302 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2BC2D8F428CF3A6F00CAB302 /* ContentView.swift */; };
1212
2BC2D8F728CF3A7000CAB302 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 2BC2D8F628CF3A7000CAB302 /* Assets.xcassets */; };
1313
2BC2D8FA28CF3A7000CAB302 /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 2BC2D8F928CF3A7000CAB302 /* Preview Assets.xcassets */; };
14+
B10677FE2BE8D0D400957B4E /* DownArrow.swift in Sources */ = {isa = PBXBuildFile; fileRef = B10677FD2BE8D0D400957B4E /* DownArrow.swift */; };
15+
B1098E7D2BD94ED900BC19DD /* WaveView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B1098E7C2BD94ED900BC19DD /* WaveView.swift */; };
16+
B11B983A2BCE9C3F00D76016 /* CheckView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B11B98392BCE9C3F00D76016 /* CheckView.swift */; };
17+
B14AB36C2BC41B05004B09C4 /* ProgressView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B14AB36B2BC41B05004B09C4 /* ProgressView.swift */; };
18+
B153FD0E2BFB566000AEFE83 /* ExampleListRow.swift in Sources */ = {isa = PBXBuildFile; fileRef = B153FD0D2BFB566000AEFE83 /* ExampleListRow.swift */; };
19+
B153FD102BFB649300AEFE83 /* ExampleListModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = B153FD0F2BFB649300AEFE83 /* ExampleListModel.swift */; };
20+
B177713F2BF39A60001723EC /* ModelClass.swift in Sources */ = {isa = PBXBuildFile; fileRef = B177713E2BF39A60001723EC /* ModelClass.swift */; };
21+
B19E0B662BF7498700E65974 /* ExampleProgressView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B19E0B652BF7498700E65974 /* ExampleProgressView.swift */; };
22+
B1DFCA512BF4FA3D00F01505 /* ProgressCircle.swift in Sources */ = {isa = PBXBuildFile; fileRef = B1DFCA502BF4FA3D00F01505 /* ProgressCircle.swift */; };
23+
B1DFCA532BF4FC7900F01505 /* ArrowView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B1DFCA522BF4FC7900F01505 /* ArrowView.swift */; };
1424
/* End PBXBuildFile section */
1525

1626
/* Begin PBXFileReference section */
@@ -19,6 +29,16 @@
1929
2BC2D8F428CF3A6F00CAB302 /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = "<group>"; };
2030
2BC2D8F628CF3A7000CAB302 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
2131
2BC2D8F928CF3A7000CAB302 /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = "<group>"; };
32+
B10677FD2BE8D0D400957B4E /* DownArrow.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DownArrow.swift; sourceTree = "<group>"; };
33+
B1098E7C2BD94ED900BC19DD /* WaveView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WaveView.swift; sourceTree = "<group>"; };
34+
B11B98392BCE9C3F00D76016 /* CheckView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CheckView.swift; sourceTree = "<group>"; };
35+
B14AB36B2BC41B05004B09C4 /* ProgressView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProgressView.swift; sourceTree = "<group>"; };
36+
B153FD0D2BFB566000AEFE83 /* ExampleListRow.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ExampleListRow.swift; sourceTree = "<group>"; };
37+
B153FD0F2BFB649300AEFE83 /* ExampleListModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ExampleListModel.swift; sourceTree = "<group>"; };
38+
B177713E2BF39A60001723EC /* ModelClass.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ModelClass.swift; sourceTree = "<group>"; };
39+
B19E0B652BF7498700E65974 /* ExampleProgressView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ExampleProgressView.swift; sourceTree = "<group>"; };
40+
B1DFCA502BF4FA3D00F01505 /* ProgressCircle.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProgressCircle.swift; sourceTree = "<group>"; };
41+
B1DFCA522BF4FC7900F01505 /* ArrowView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ArrowView.swift; sourceTree = "<group>"; };
2242
/* End PBXFileReference section */
2343

2444
/* Begin PBXFrameworksBuildPhase section */
@@ -51,6 +71,8 @@
5171
2BC2D8F128CF3A6F00CAB302 /* SSSwiftUIAnimations */ = {
5272
isa = PBXGroup;
5373
children = (
74+
B14AB36A2BC40286004B09C4 /* ProgressAnimation */,
75+
B153FD112BFB64BE00AEFE83 /* Examples */,
5476
2BC2D8F228CF3A6F00CAB302 /* SSSwiftUIAnimationsApp.swift */,
5577
2BC2D8F428CF3A6F00CAB302 /* ContentView.swift */,
5678
2BC2D8F628CF3A7000CAB302 /* Assets.xcassets */,
@@ -67,6 +89,38 @@
6789
path = "Preview Content";
6890
sourceTree = "<group>";
6991
};
92+
B14AB36A2BC40286004B09C4 /* ProgressAnimation */ = {
93+
isa = PBXGroup;
94+
children = (
95+
B14AB36B2BC41B05004B09C4 /* ProgressView.swift */,
96+
B1DFCA502BF4FA3D00F01505 /* ProgressCircle.swift */,
97+
B1DFCA522BF4FC7900F01505 /* ArrowView.swift */,
98+
B10677FD2BE8D0D400957B4E /* DownArrow.swift */,
99+
B1098E7C2BD94ED900BC19DD /* WaveView.swift */,
100+
B11B98392BCE9C3F00D76016 /* CheckView.swift */,
101+
B177713E2BF39A60001723EC /* ModelClass.swift */,
102+
);
103+
path = ProgressAnimation;
104+
sourceTree = "<group>";
105+
};
106+
B153FD112BFB64BE00AEFE83 /* Examples */ = {
107+
isa = PBXGroup;
108+
children = (
109+
B19E0B652BF7498700E65974 /* ExampleProgressView.swift */,
110+
B1F9ED332BFCD85000189871 /* ExamplesList */,
111+
);
112+
path = Examples;
113+
sourceTree = "<group>";
114+
};
115+
B1F9ED332BFCD85000189871 /* ExamplesList */ = {
116+
isa = PBXGroup;
117+
children = (
118+
B153FD0F2BFB649300AEFE83 /* ExampleListModel.swift */,
119+
B153FD0D2BFB566000AEFE83 /* ExampleListRow.swift */,
120+
);
121+
path = ExamplesList;
122+
sourceTree = "<group>";
123+
};
70124
/* End PBXGroup section */
71125

72126
/* Begin PBXNativeTarget section */
@@ -137,8 +191,18 @@
137191
isa = PBXSourcesBuildPhase;
138192
buildActionMask = 2147483647;
139193
files = (
194+
B153FD0E2BFB566000AEFE83 /* ExampleListRow.swift in Sources */,
140195
2BC2D8F528CF3A6F00CAB302 /* ContentView.swift in Sources */,
196+
B153FD102BFB649300AEFE83 /* ExampleListModel.swift in Sources */,
197+
B177713F2BF39A60001723EC /* ModelClass.swift in Sources */,
198+
B10677FE2BE8D0D400957B4E /* DownArrow.swift in Sources */,
199+
B1098E7D2BD94ED900BC19DD /* WaveView.swift in Sources */,
200+
B19E0B662BF7498700E65974 /* ExampleProgressView.swift in Sources */,
141201
2BC2D8F328CF3A6F00CAB302 /* SSSwiftUIAnimationsApp.swift in Sources */,
202+
B1DFCA532BF4FC7900F01505 /* ArrowView.swift in Sources */,
203+
B11B983A2BCE9C3F00D76016 /* CheckView.swift in Sources */,
204+
B1DFCA512BF4FA3D00F01505 /* ProgressCircle.swift in Sources */,
205+
B14AB36C2BC41B05004B09C4 /* ProgressView.swift in Sources */,
142206
);
143207
runOnlyForDeploymentPostprocessing = 0;
144208
};

SSSwiftUIAnimations/SSSwiftUIAnimations/ContentView.swift

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,26 @@
88
import SwiftUI
99

1010
struct ContentView: View {
11+
private var exampleList = ExampleListModel.exampleList
12+
1113
var body: some View {
12-
Text("Hello, world!")
13-
.padding()
14+
NavigationView {
15+
ZStack {
16+
List{
17+
ForEach(exampleList) {item in
18+
ExampleListRow(exampleListItem: item)
19+
}
20+
}.listStyle(.insetGrouped)
21+
.listRowSpacing(10)
22+
.listRowSeparator(.hidden)
23+
.navigationBarTitleDisplayMode(.inline)
24+
.toolbar {
25+
ToolbarItem(placement: .principal) {
26+
Text("Examples").font(Font.system(size: 30, weight: .bold)).foregroundStyle(Color.indigo)
27+
}
28+
}
29+
}
30+
}
1431
}
1532
}
1633

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,7 @@ struct ExampleProgressView: View {
3737
}
3838
}
3939
}
40+
41+
#Preview {
42+
ExampleProgressView()
43+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
//
2+
// ExampleListModel.swift
3+
// SSSwiftUIAnimations
4+
//
5+
// Created by Mansi Prajapati on 20/05/24.
6+
//
7+
8+
import SwiftUI
9+
10+
class ExampleListModel: Identifiable {
11+
12+
// MARK: - Variables
13+
var id = UUID()
14+
var rowTitle: String
15+
var destinationView: AnyView
16+
17+
// MARK: - init
18+
init(rowTitle: String, destinationView: AnyView) {
19+
self.rowTitle = rowTitle
20+
self.destinationView = destinationView
21+
}
22+
23+
// data for example row list
24+
static let exampleList = [ExampleListModel(rowTitle: "ProgressView", destinationView: AnyView(ExampleProgressView()))]
25+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
//
2+
// ExampleListRow.swift
3+
// SSSwiftUIAnimations
4+
//
5+
// Created by Mansi Prajapati on 20/05/24.
6+
//
7+
8+
import SwiftUI
9+
10+
struct ExampleListRow: View {
11+
var exampleListItem: ExampleListModel
12+
13+
var body: some View {
14+
NavigationLink(destination: exampleListItem.destinationView) {
15+
Text(exampleListItem.rowTitle)
16+
.font(Font.system(size: 16, weight: .bold))
17+
.foregroundStyle(.indigo)
18+
}.listRowBackground(
19+
Capsule()
20+
.fill(
21+
LinearGradient(
22+
gradient: Gradient(colors: [Color.mint, Color.pink]),
23+
startPoint: .topLeading,
24+
endPoint: .bottomTrailing)
25+
)
26+
.padding(.vertical, 2).padding(.horizontal, 0)
27+
)
28+
}
29+
}

SSSwiftUIAnimations/SSSwiftUIAnimations/ProgressAnimation/ProgressView.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ struct SSProgressView: View {
116116

117117
private func progressAnimation() {
118118
// Showing percentage text once initial animation is done
119-
initialTimer = Timer.scheduledTimer(withTimeInterval: 0.5, repeats: false) { timer in
119+
initialTimer = Timer.scheduledTimer(withTimeInterval: 0.6, repeats: false) { timer in
120120
withAnimation(Animation.linear(duration: 0.2)) {
121121
showPercent = true
122122
startDotAnim = true

0 commit comments

Comments
 (0)