Skip to content

Commit 0b81992

Browse files
committed
Update example app
1 parent 7c9682c commit 0b81992

4 files changed

Lines changed: 51 additions & 3 deletions

File tree

Example/SettingExample.xcodeproj/project.pbxproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
3C25FE1D29A6B0AF00C11678 /* Utilities.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3C25FE1C29A6B0AF00C11678 /* Utilities.swift */; };
1313
3C25FE1F29A6B0D700C11678 /* SettingsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3C25FE1E29A6B0D700C11678 /* SettingsView.swift */; };
1414
3C25FE2229A6C24C00C11678 /* ControlPanelView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3C25FE2129A6C24C00C11678 /* ControlPanelView.swift */; };
15+
3C25FE2429A6D2A300C11678 /* PlaygroundView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3C25FE2329A6D2A300C11678 /* PlaygroundView.swift */; };
1516
3CD8B78C29A683D100463C48 /* SettingExampleApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3CD8B78B29A683D100463C48 /* SettingExampleApp.swift */; };
1617
3CD8B78E29A683D100463C48 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3CD8B78D29A683D100463C48 /* ContentView.swift */; };
1718
3CD8B79029A683D300463C48 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 3CD8B78F29A683D300463C48 /* Assets.xcassets */; };
@@ -23,6 +24,7 @@
2324
3C25FE1E29A6B0D700C11678 /* SettingsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsView.swift; sourceTree = "<group>"; };
2425
3C25FE2029A6B2FB00C11678 /* Setting */ = {isa = PBXFileReference; lastKnownFileType = wrapper; name = Setting; path = ..; sourceTree = "<group>"; };
2526
3C25FE2129A6C24C00C11678 /* ControlPanelView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ControlPanelView.swift; sourceTree = "<group>"; };
27+
3C25FE2329A6D2A300C11678 /* PlaygroundView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PlaygroundView.swift; sourceTree = "<group>"; };
2628
3CD8B78829A683D100463C48 /* SettingExample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = SettingExample.app; sourceTree = BUILT_PRODUCTS_DIR; };
2729
3CD8B78B29A683D100463C48 /* SettingExampleApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingExampleApp.swift; sourceTree = "<group>"; };
2830
3CD8B78D29A683D100463C48 /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = "<group>"; };
@@ -67,6 +69,7 @@
6769
3C25FE1A29A6B06C00C11678 /* PreferencesView.swift */,
6870
3C25FE1E29A6B0D700C11678 /* SettingsView.swift */,
6971
3C25FE2129A6C24C00C11678 /* ControlPanelView.swift */,
72+
3C25FE2329A6D2A300C11678 /* PlaygroundView.swift */,
7073
3C25FE1C29A6B0AF00C11678 /* Utilities.swift */,
7174
3CD8B78F29A683D300463C48 /* Assets.xcassets */,
7275
3CD8B79129A683D300463C48 /* SettingExample.entitlements */,
@@ -149,6 +152,7 @@
149152
isa = PBXSourcesBuildPhase;
150153
buildActionMask = 2147483647;
151154
files = (
155+
3C25FE2429A6D2A300C11678 /* PlaygroundView.swift in Sources */,
152156
3C25FE1B29A6B06C00C11678 /* PreferencesView.swift in Sources */,
153157
3CD8B78E29A683D100463C48 /* ContentView.swift in Sources */,
154158
3C25FE1F29A6B0D700C11678 /* SettingsView.swift in Sources */,

Example/SettingExample/ContentView.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,12 @@ struct ContentView: View {
2929
.tabItem {
3030
Label("Control Panel", systemImage: "dial.high")
3131
}
32+
.tag(2)
33+
34+
PlaygroundView()
35+
.tabItem {
36+
Label("Playground", systemImage: "gamecontroller")
37+
}
3238
.tag(3)
3339
}
3440
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
//
2+
// PlaygroundView.swift
3+
// SettingExample
4+
//
5+
// Created by A. Zheng (github.com/aheze) on 2/22/23.
6+
// Copyright © 2023 A. Zheng. All rights reserved.
7+
//
8+
9+
import Setting
10+
import SwiftUI
11+
12+
struct PlaygroundView: View {
13+
var body: some View {
14+
SettingStack {
15+
SettingPage(title: "Playground") {
16+
SettingCustomView {
17+
Color.blue
18+
.opacity(0.1)
19+
.cornerRadius(12)
20+
.overlay {
21+
Text("Put anything here!")
22+
.foregroundColor(.blue)
23+
.font(.title.bold())
24+
}
25+
.frame(height: 150)
26+
.padding(.horizontal, 16)
27+
}
28+
}
29+
}
30+
}
31+
}
32+
33+
struct PlaygroundView_Previews: PreviewProvider {
34+
static var previews: some View {
35+
PlaygroundView()
36+
}
37+
}

Example/SettingExample/PreferencesView.swift

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,12 @@ struct PreferencesView: View {
3737
)
3838
) {
3939
SettingCustomView(id: "Header View") {
40-
VStack(spacing: 8) {
40+
VStack(spacing: 10) {
41+
Image(systemName: "gearshape.fill")
42+
.font(.largeTitle)
43+
4144
Text("Welcome to Setting!")
4245
.font(.headline)
43-
44-
Text("Feel free to play around with this example app.")
4546
}
4647
.multilineTextAlignment(.center)
4748
.foregroundColor(Color(hex: 0x006DC1))

0 commit comments

Comments
 (0)