Skip to content

Commit 5c3c844

Browse files
committed
Adding Examples
1 parent 4cd95d2 commit 5c3c844

File tree

11 files changed

+787
-1
lines changed

11 files changed

+787
-1
lines changed

Examples/Examples.xcodeproj/project.pbxproj

+480
Large diffs are not rendered by default.

Examples/Examples.xcodeproj/project.xcworkspace/contents.xcworkspacedata

+7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
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>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"object": {
3+
"pins": [
4+
{
5+
"package": "swift-case-paths",
6+
"repositoryURL": "https://github.com/pointfreeco/swift-case-paths",
7+
"state": {
8+
"branch": null,
9+
"revision": "b4a872984463070c71e2e97e5c02c73a07d0fe36",
10+
"version": "0.9.0"
11+
}
12+
},
13+
{
14+
"package": "swiftui-navigation",
15+
"repositoryURL": "https://github.com/pointfreeco/swiftui-navigation",
16+
"state": {
17+
"branch": null,
18+
"revision": "2694c03284a368168b3e0b8d7ab52626802d2246",
19+
"version": "0.1.0"
20+
}
21+
}
22+
]
23+
},
24+
"version": 1
25+
}
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+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
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" : "2x",
76+
"size" : "76x76"
77+
},
78+
{
79+
"idiom" : "ipad",
80+
"scale" : "2x",
81+
"size" : "83.5x83.5"
82+
},
83+
{
84+
"idiom" : "ios-marketing",
85+
"scale" : "1x",
86+
"size" : "1024x1024"
87+
},
88+
{
89+
"idiom" : "mac",
90+
"scale" : "1x",
91+
"size" : "16x16"
92+
},
93+
{
94+
"idiom" : "mac",
95+
"scale" : "2x",
96+
"size" : "16x16"
97+
},
98+
{
99+
"idiom" : "mac",
100+
"scale" : "1x",
101+
"size" : "32x32"
102+
},
103+
{
104+
"idiom" : "mac",
105+
"scale" : "2x",
106+
"size" : "32x32"
107+
},
108+
{
109+
"idiom" : "mac",
110+
"scale" : "1x",
111+
"size" : "128x128"
112+
},
113+
{
114+
"idiom" : "mac",
115+
"scale" : "2x",
116+
"size" : "128x128"
117+
},
118+
{
119+
"idiom" : "mac",
120+
"scale" : "1x",
121+
"size" : "256x256"
122+
},
123+
{
124+
"idiom" : "mac",
125+
"scale" : "2x",
126+
"size" : "256x256"
127+
},
128+
{
129+
"idiom" : "mac",
130+
"scale" : "1x",
131+
"size" : "512x512"
132+
},
133+
{
134+
"idiom" : "mac",
135+
"scale" : "2x",
136+
"size" : "512x512"
137+
}
138+
],
139+
"info" : {
140+
"author" : "xcode",
141+
"version" : 1
142+
}
143+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"info" : {
3+
"author" : "xcode",
4+
"version" : 1
5+
}
6+
}

Examples/Shared/ExamplesApp.swift

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
//
2+
// ExamplesApp.swift
3+
// Shared
4+
//
5+
// Created by Guilherme Souza on 15/06/22.
6+
//
7+
8+
import SwiftUI
9+
10+
@main
11+
struct ExamplesApp: App {
12+
var body: some Scene {
13+
WindowGroup {
14+
ExamplesView()
15+
}
16+
}
17+
}

Examples/Shared/ExamplesView.swift

+64
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
import ToastUI
2+
import SwiftUI
3+
4+
struct ExamplesView: View {
5+
@State var toast: ToastView?
6+
7+
var body: some View {
8+
VStack(spacing: 12) {
9+
Button("Regular toast") {
10+
toast = ToastView(
11+
style: .regular,
12+
icon: Image(systemName: "exclamationmark.square"),
13+
title: "Regular toast",
14+
subtitle: "This is the subtitle."
15+
)
16+
}
17+
18+
Button("Failure toast") {
19+
toast = ToastView(
20+
style: .failure,
21+
icon: Image(systemName: "exclamationmark.square"),
22+
title: "Failure toast",
23+
subtitle: "This is the subtitle."
24+
)
25+
}
26+
27+
Button("Warning toast") {
28+
toast = ToastView(
29+
style: .warning,
30+
icon: Image(systemName: "exclamationmark.square"),
31+
title: "Warning toast",
32+
subtitle: "This is the subtitle."
33+
)
34+
}
35+
36+
Button("Info toast") {
37+
toast = ToastView(
38+
style: .info,
39+
icon: Image(systemName: "exclamationmark.square"),
40+
title: "Info toast",
41+
subtitle: "This is the subtitle."
42+
)
43+
}
44+
45+
Button("Success toast") {
46+
toast = ToastView(
47+
style: .success,
48+
icon: Image(systemName: "exclamationmark.square"),
49+
title: "Success toast",
50+
subtitle: "This is the subtitle."
51+
)
52+
}
53+
}
54+
.buttonStyle(.bordered)
55+
.padding(12)
56+
.toast(item: $toast) { $0 }
57+
}
58+
}
59+
60+
struct ContentView_Previews: PreviewProvider {
61+
static var previews: some View {
62+
ExamplesView()
63+
}
64+
}

Examples/macOS/macOS.entitlements

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
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>com.apple.security.app-sandbox</key>
6+
<true/>
7+
<key>com.apple.security.files.user-selected.read-only</key>
8+
<true/>
9+
</dict>
10+
</plist>

README.md

+16-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
11
# ToastUI
22

3-
A description of this package.
3+
## Usage
4+
5+
```swift
6+
struct ContentView: View {
7+
@State var tostPresented = false
8+
9+
var body: some View {
10+
Button("Show toast") {
11+
toastPresented = true
12+
}
13+
.toast(isPresented: $toastPresented) {
14+
ToastView(title: "This a toast")
15+
}
16+
}
17+
}
18+
```

0 commit comments

Comments
 (0)