Skip to content

Commit e012641

Browse files
committed
feat: add example app
1 parent 13f8965 commit e012641

File tree

14 files changed

+1142
-0
lines changed

14 files changed

+1142
-0
lines changed

examples/cocoapods/Example.xcodeproj/project.pbxproj

Lines changed: 416 additions & 0 deletions
Large diffs are not rendered by default.

examples/cocoapods/Example.xcodeproj/project.xcworkspace/contents.xcworkspacedata

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>IDEDidComputeMac32BitWarning</key>
6+
<true/>
7+
</dict>
8+
</plist>

examples/cocoapods/Example.xcworkspace/contents.xcworkspacedata

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>IDEDidComputeMac32BitWarning</key>
6+
<true/>
7+
</dict>
8+
</plist>
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"colors" : [
3+
{
4+
"idiom" : "universal"
5+
}
6+
],
7+
"info" : {
8+
"author" : "xcode",
9+
"version" : 1
10+
}
11+
}
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
{
2+
"images" : [
3+
{
4+
"idiom" : "iphone",
5+
"scale" : "2x",
6+
"size" : "20x20"
7+
},
8+
{
9+
"idiom" : "iphone",
10+
"scale" : "3x",
11+
"size" : "20x20"
12+
},
13+
{
14+
"idiom" : "iphone",
15+
"scale" : "2x",
16+
"size" : "29x29"
17+
},
18+
{
19+
"idiom" : "iphone",
20+
"scale" : "3x",
21+
"size" : "29x29"
22+
},
23+
{
24+
"idiom" : "iphone",
25+
"scale" : "2x",
26+
"size" : "40x40"
27+
},
28+
{
29+
"idiom" : "iphone",
30+
"scale" : "3x",
31+
"size" : "40x40"
32+
},
33+
{
34+
"idiom" : "iphone",
35+
"scale" : "2x",
36+
"size" : "60x60"
37+
},
38+
{
39+
"idiom" : "iphone",
40+
"scale" : "3x",
41+
"size" : "60x60"
42+
},
43+
{
44+
"idiom" : "ipad",
45+
"scale" : "1x",
46+
"size" : "20x20"
47+
},
48+
{
49+
"idiom" : "ipad",
50+
"scale" : "2x",
51+
"size" : "20x20"
52+
},
53+
{
54+
"idiom" : "ipad",
55+
"scale" : "1x",
56+
"size" : "29x29"
57+
},
58+
{
59+
"idiom" : "ipad",
60+
"scale" : "2x",
61+
"size" : "29x29"
62+
},
63+
{
64+
"idiom" : "ipad",
65+
"scale" : "1x",
66+
"size" : "40x40"
67+
},
68+
{
69+
"idiom" : "ipad",
70+
"scale" : "2x",
71+
"size" : "40x40"
72+
},
73+
{
74+
"idiom" : "ipad",
75+
"scale" : "1x",
76+
"size" : "76x76"
77+
},
78+
{
79+
"idiom" : "ipad",
80+
"scale" : "2x",
81+
"size" : "76x76"
82+
},
83+
{
84+
"idiom" : "ipad",
85+
"scale" : "2x",
86+
"size" : "83.5x83.5"
87+
},
88+
{
89+
"idiom" : "ios-marketing",
90+
"scale" : "1x",
91+
"size" : "1024x1024"
92+
}
93+
],
94+
"info" : {
95+
"author" : "xcode",
96+
"version" : 1
97+
}
98+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"info" : {
3+
"author" : "xcode",
4+
"version" : 1
5+
}
6+
}
Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
//
2+
// ContentView.swift
3+
// Example
4+
//
5+
// Created by Scott on 2022/6/9.
6+
//
7+
8+
import SwiftUI
9+
10+
struct ContentView: View {
11+
12+
@StateObject private var viewModel = ViewModel()
13+
14+
var body: some View {
15+
List {
16+
HStack {
17+
Button("ping") {
18+
Task {
19+
await viewModel.callPing()
20+
}
21+
}.foregroundColor(.green)
22+
if let ping = viewModel.ping {
23+
Text(String(ping))
24+
}
25+
}
26+
Section {
27+
Button("getLatestBlock") {
28+
Task {
29+
await viewModel.callGetLastest()
30+
}
31+
}.foregroundColor(.green)
32+
if viewModel.latestBlockText.isEmpty == false {
33+
Text(viewModel.latestBlockText)
34+
}
35+
}
36+
Section {
37+
Button("sendTransaction") {
38+
Task {
39+
await viewModel.sendTransaction()
40+
}
41+
}.foregroundColor(.green)
42+
if viewModel.sendTransactionText.isEmpty == false {
43+
Text(viewModel.sendTransactionText)
44+
}
45+
Button("getTransaction") {
46+
Task {
47+
await viewModel.getTransaction()
48+
}
49+
}.foregroundColor(.green)
50+
if viewModel.getTransactionText.isEmpty == false {
51+
Text(viewModel.getTransactionText)
52+
}
53+
Button("getTransactionResult") {
54+
Task {
55+
await viewModel.getTransactionResult()
56+
}
57+
}.foregroundColor(.green)
58+
if viewModel.getTransactionResultText.isEmpty == false {
59+
Text(viewModel.getTransactionResultText)
60+
}
61+
}
62+
Section {
63+
Button("getAccountAtLatestBlock") {
64+
Task {
65+
await viewModel.getAccountAtLatestBlock()
66+
}
67+
}.foregroundColor(.green)
68+
if viewModel.getAccountAtLatestBlockText.isEmpty == false {
69+
Text(viewModel.getAccountAtLatestBlockText)
70+
}
71+
}
72+
Section {
73+
Button("executeScriptAtLatestBlock") {
74+
Task {
75+
await viewModel.executeScriptAtLatestBlock()
76+
}
77+
}.foregroundColor(.green)
78+
if viewModel.executeScriptAtLatestBlockText.isEmpty == false {
79+
Text(viewModel.executeScriptAtLatestBlockText)
80+
}
81+
}
82+
Section {
83+
Button("getEventsForHeightRange") {
84+
Task {
85+
await viewModel.getEventsForHeightRange()
86+
}
87+
}.foregroundColor(.green)
88+
if viewModel.getEventsForHeightRangeText.isEmpty == false {
89+
Text(viewModel.getEventsForHeightRangeText)
90+
}
91+
}
92+
Section {
93+
Button("getNetworkParameters") {
94+
Task {
95+
await viewModel.getNetworkParameters()
96+
}
97+
}.foregroundColor(.green)
98+
if viewModel.getNetworkParametersText.isEmpty == false {
99+
Text(viewModel.getNetworkParametersText)
100+
}
101+
}
102+
}
103+
}
104+
105+
}
106+
107+
struct ContentView_Previews: PreviewProvider {
108+
static var previews: some View {
109+
ContentView()
110+
}
111+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
//
2+
// ExampleApp.swift
3+
// Example
4+
//
5+
// Created by Scott on 2022/6/9.
6+
//
7+
8+
import SwiftUI
9+
10+
@main
11+
struct ExampleApp: App {
12+
var body: some Scene {
13+
WindowGroup {
14+
ContentView()
15+
}
16+
}
17+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"info" : {
3+
"author" : "xcode",
4+
"version" : 1
5+
}
6+
}

0 commit comments

Comments
 (0)