Skip to content

Commit

Permalink
feat: add example app
Browse files Browse the repository at this point in the history
  • Loading branch information
scottphc committed Jul 28, 2022
1 parent 13f8965 commit e012641
Show file tree
Hide file tree
Showing 14 changed files with 1,142 additions and 0 deletions.
416 changes: 416 additions & 0 deletions examples/cocoapods/Example.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
10 changes: 10 additions & 0 deletions examples/cocoapods/Example.xcworkspace/contents.xcworkspacedata

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"colors" : [
{
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
{
"images" : [
{
"idiom" : "iphone",
"scale" : "2x",
"size" : "20x20"
},
{
"idiom" : "iphone",
"scale" : "3x",
"size" : "20x20"
},
{
"idiom" : "iphone",
"scale" : "2x",
"size" : "29x29"
},
{
"idiom" : "iphone",
"scale" : "3x",
"size" : "29x29"
},
{
"idiom" : "iphone",
"scale" : "2x",
"size" : "40x40"
},
{
"idiom" : "iphone",
"scale" : "3x",
"size" : "40x40"
},
{
"idiom" : "iphone",
"scale" : "2x",
"size" : "60x60"
},
{
"idiom" : "iphone",
"scale" : "3x",
"size" : "60x60"
},
{
"idiom" : "ipad",
"scale" : "1x",
"size" : "20x20"
},
{
"idiom" : "ipad",
"scale" : "2x",
"size" : "20x20"
},
{
"idiom" : "ipad",
"scale" : "1x",
"size" : "29x29"
},
{
"idiom" : "ipad",
"scale" : "2x",
"size" : "29x29"
},
{
"idiom" : "ipad",
"scale" : "1x",
"size" : "40x40"
},
{
"idiom" : "ipad",
"scale" : "2x",
"size" : "40x40"
},
{
"idiom" : "ipad",
"scale" : "1x",
"size" : "76x76"
},
{
"idiom" : "ipad",
"scale" : "2x",
"size" : "76x76"
},
{
"idiom" : "ipad",
"scale" : "2x",
"size" : "83.5x83.5"
},
{
"idiom" : "ios-marketing",
"scale" : "1x",
"size" : "1024x1024"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
6 changes: 6 additions & 0 deletions examples/cocoapods/Example/Assets.xcassets/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}
111 changes: 111 additions & 0 deletions examples/cocoapods/Example/ContentView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
//
// ContentView.swift
// Example
//
// Created by Scott on 2022/6/9.
//

import SwiftUI

struct ContentView: View {

@StateObject private var viewModel = ViewModel()

var body: some View {
List {
HStack {
Button("ping") {
Task {
await viewModel.callPing()
}
}.foregroundColor(.green)
if let ping = viewModel.ping {
Text(String(ping))
}
}
Section {
Button("getLatestBlock") {
Task {
await viewModel.callGetLastest()
}
}.foregroundColor(.green)
if viewModel.latestBlockText.isEmpty == false {
Text(viewModel.latestBlockText)
}
}
Section {
Button("sendTransaction") {
Task {
await viewModel.sendTransaction()
}
}.foregroundColor(.green)
if viewModel.sendTransactionText.isEmpty == false {
Text(viewModel.sendTransactionText)
}
Button("getTransaction") {
Task {
await viewModel.getTransaction()
}
}.foregroundColor(.green)
if viewModel.getTransactionText.isEmpty == false {
Text(viewModel.getTransactionText)
}
Button("getTransactionResult") {
Task {
await viewModel.getTransactionResult()
}
}.foregroundColor(.green)
if viewModel.getTransactionResultText.isEmpty == false {
Text(viewModel.getTransactionResultText)
}
}
Section {
Button("getAccountAtLatestBlock") {
Task {
await viewModel.getAccountAtLatestBlock()
}
}.foregroundColor(.green)
if viewModel.getAccountAtLatestBlockText.isEmpty == false {
Text(viewModel.getAccountAtLatestBlockText)
}
}
Section {
Button("executeScriptAtLatestBlock") {
Task {
await viewModel.executeScriptAtLatestBlock()
}
}.foregroundColor(.green)
if viewModel.executeScriptAtLatestBlockText.isEmpty == false {
Text(viewModel.executeScriptAtLatestBlockText)
}
}
Section {
Button("getEventsForHeightRange") {
Task {
await viewModel.getEventsForHeightRange()
}
}.foregroundColor(.green)
if viewModel.getEventsForHeightRangeText.isEmpty == false {
Text(viewModel.getEventsForHeightRangeText)
}
}
Section {
Button("getNetworkParameters") {
Task {
await viewModel.getNetworkParameters()
}
}.foregroundColor(.green)
if viewModel.getNetworkParametersText.isEmpty == false {
Text(viewModel.getNetworkParametersText)
}
}
}
}

}

struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
}
}
17 changes: 17 additions & 0 deletions examples/cocoapods/Example/ExampleApp.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
//
// ExampleApp.swift
// Example
//
// Created by Scott on 2022/6/9.
//

import SwiftUI

@main
struct ExampleApp: App {
var body: some Scene {
WindowGroup {
ContentView()
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading

0 comments on commit e012641

Please sign in to comment.