Skip to content

Commit 8f21b6c

Browse files
committed
Update Demo
1 parent 850d515 commit 8f21b6c

File tree

2 files changed

+64
-18
lines changed

2 files changed

+64
-18
lines changed

Demo/What's New?/ContentView.swift

Lines changed: 37 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,33 +9,56 @@ import SwiftUI
99
import SwiftNEW
1010

1111
struct ContentView: View {
12-
// MARK: - All States
12+
13+
@State var preview: String = "Normal"
14+
15+
// MARK: All States
1316
@State var showNew: Bool = false
1417
@State var align: HorizontalAlignment = .center
1518
@State var color: Color = .accentColor
1619
@State var size: String = "normal"
1720
@State var labelColor: Color = Color(UIColor.systemBackground)
1821
@State var label: String = "Show Release Note"
1922
@State var labelImage: String = "arrow.up.circle.fill"
23+
@State var history: Bool = true
24+
@State var data: String = "data"
25+
2026
var body: some View {
2127
NavigationView {
22-
// MARK: Choose either one size (Normal, Mini or invisible)
2328

24-
// MARK: Normal
25-
SwiftNEW(show: $showNew, align: $align, color: $color, size: $size, labelColor: $labelColor, label: $label, labelImage: $labelImage)
29+
// MARK: Choose either one size (Normal, Mini or Invisible)
2630

27-
.toolbar {
28-
ToolbarItemGroup(placement: .navigationBarLeading) {
29-
// MARK: Invisible
30-
SwiftNEW(show: $showNew, align: $align, color: $color, size: .constant("invisible"), labelColor: $labelColor, label: $label, labelImage: $labelImage)
31-
}
32-
ToolbarItemGroup(placement: .navigationBarTrailing) {
33-
// MARK: Mini
34-
SwiftNEW(show: $showNew, align: $align, color: $color, size: .constant("mini"), labelColor: $labelColor, label: $label, labelImage: $labelImage)
35-
}
31+
TabView(selection: $preview) {
32+
33+
// MARK: - Normal
34+
SwiftNEW(show: $showNew, align: $align, color: $color, size: $size, labelColor: $labelColor, label: $label, labelImage: $labelImage, history: $history, data: $data)
35+
36+
// Don't copy tabItem
37+
.tabItem { Text("Normal") }.tag("Normal")
38+
39+
// MARK: - Mini (Toolbar only)
40+
Text("Compatible with Toolbar")
41+
.tabItem { Text("Mini") }.tag("Mini")
42+
43+
// MARK: - Invisible
44+
SwiftNEW(show: $showNew, align: $align, color: $color, size: .constant("invisible"), labelColor: $labelColor, label: $label, labelImage: $labelImage, history: $history, data: $data)
3645

46+
// Don't copy tabItem
47+
.tabItem { Text("Invisible") }.tag("Invisible")
48+
49+
// MARK: - Remote Test (>3.0.0)
50+
// Firebase Real Time Database Demo
51+
SwiftNEW(show: $showNew, align: $align, color: $color, size: $size, labelColor: $labelColor, label: $label, labelImage: .constant("icloud"), history: $history, data: .constant("https://testground-a937f-default-rtdb.firebaseio.com/.json?print=pretty"))
52+
53+
// Don't copy tabItem
54+
.tabItem { Text("Remote") }.tag("Remote")
55+
56+
}
57+
.toolbar {
58+
if preview == "Mini" {
59+
SwiftNEW(show: $showNew, align: $align, color: $color, size: .constant("mini"), labelColor: $labelColor, label: $label, labelImage: $labelImage, history: $history, data: $data)
3760
}
38-
61+
}
3962
}
4063
#if os(iOS)
4164
.navigationViewStyle(.stack)

Demo/What's New?/data.json

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,36 @@
11
[
22
{
3-
"version": "1.1",
3+
"version": "1.2",
44
"new": [
55
{
6-
"icon": "pencil.and.ruler.fill",
7-
"title": "Apple Pencil 3",
6+
"icon": "hammer.fill",
7+
"title": "Bug fixes",
8+
"subtitle": "Broken UI",
9+
"body": "Available for iOS 16, iPadOS 16, macOS 13"
10+
},
11+
{
12+
"icon": "square.and.arrow.down.fill",
13+
"title": "Remote File",
814
"subtitle": "Supported",
9-
"body": "Available for the new iPad Pro"
15+
"body": "Direct load via remote storage. Easy!"
16+
},
17+
{
18+
"icon": "macpro.gen3.server",
19+
"title": "Serverless",
20+
"subtitle": "Design",
21+
"body": "Free and open source! Created by Ming with ❤️‍🔥"
1022
},
23+
{
24+
"icon": "arrow.triangle.pull",
25+
"title": "Contribute",
26+
"subtitle": "Together",
27+
"body": "Pull requests and make it better for everyone!"
28+
}
29+
]
30+
},
31+
{
32+
"version": "1.1",
33+
"new": [
1134
{
1235
"icon": "hammer.fill",
1336
"title": "Bug fixes",

0 commit comments

Comments
 (0)