Skip to content

Commit c63e8af

Browse files
committed
extend spm test app
1 parent 9fc3ad1 commit c63e8af

File tree

6 files changed

+97
-31
lines changed

6 files changed

+97
-31
lines changed

pods_testProject/pod_test.xcodeproj/project.pbxproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@
77
objects = {
88

99
/* Begin PBXBuildFile section */
10-
2884CAC32D061DBC005E00A6 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2884CAC22D061DBC005E00A6 /* ContentView.swift */; };
10+
28A0A8062D08FA3B007EF675 /* ContentView1.swift in Sources */ = {isa = PBXBuildFile; fileRef = 28A0A8052D08FA3B007EF675 /* ContentView1.swift */; };
1111
2F09D4C844F74D4B8F079160 /* libPods-pod_test.a in Frameworks */ = {isa = PBXBuildFile; fileRef = DC30F6DDA748D5FF5BC38BAB /* libPods-pod_test.a */; };
1212
7ED306A82AF833B500F6FFE3 /* SomeObjcClass.m in Sources */ = {isa = PBXBuildFile; fileRef = 7ED306A62AF8337400F6FFE3 /* SomeObjcClass.m */; };
1313
7ED5176E2AF68AB700D29ED7 /* pod_testApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7ED5176D2AF68AB700D29ED7 /* pod_testApp.swift */; };
1414
/* End PBXBuildFile section */
1515

1616
/* Begin PBXFileReference section */
17-
2884CAC22D061DBC005E00A6 /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = ContentView.swift; path = ../spm_testProject/spm_test/ContentView.swift; sourceTree = SOURCE_ROOT; };
17+
28A0A8052D08FA3B007EF675 /* ContentView1.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = ContentView1.swift; path = ../spm_testProject/spm_test/ContentView1.swift; sourceTree = SOURCE_ROOT; };
1818
7ED306A62AF8337400F6FFE3 /* SomeObjcClass.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SomeObjcClass.m; sourceTree = "<group>"; };
1919
7ED306A72AF8337700F6FFE3 /* SomeObjcClass.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SomeObjcClass.h; sourceTree = "<group>"; };
2020
7ED5176A2AF68AB700D29ED7 /* pod_test.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = pod_test.app; sourceTree = BUILT_PRODUCTS_DIR; };
@@ -75,7 +75,7 @@
7575
isa = PBXGroup;
7676
children = (
7777
7ED5176D2AF68AB700D29ED7 /* pod_testApp.swift */,
78-
2884CAC22D061DBC005E00A6 /* ContentView.swift */,
78+
28A0A8052D08FA3B007EF675 /* ContentView1.swift */,
7979
7ED306A72AF8337700F6FFE3 /* SomeObjcClass.h */,
8080
7ED306A62AF8337400F6FFE3 /* SomeObjcClass.m */,
8181
);
@@ -177,9 +177,9 @@
177177
isa = PBXSourcesBuildPhase;
178178
buildActionMask = 2147483647;
179179
files = (
180+
28A0A8062D08FA3B007EF675 /* ContentView1.swift in Sources */,
180181
7ED306A82AF833B500F6FFE3 /* SomeObjcClass.m in Sources */,
181182
7ED5176E2AF68AB700D29ED7 /* pod_testApp.swift in Sources */,
182-
2884CAC32D061DBC005E00A6 /* ContentView.swift in Sources */,
183183
);
184184
runOnlyForDeploymentPostprocessing = 0;
185185
};

pods_testProject/pod_test/pod_testApp.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ struct pod_testApp: App {
99
var body: some Scene {
1010
WindowGroup {
1111
NavigationView {
12-
ContentView()
12+
ContentView1()
1313
.navigationTitle("Pods Test App")
1414
}
1515
}

spm_testProject/spm_test.xcodeproj/project.pbxproj

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,20 @@
77
objects = {
88

99
/* Begin PBXBuildFile section */
10+
28A0A8022D08F7BA007EF675 /* ContentView 2.swift in Sources */ = {isa = PBXBuildFile; fileRef = 28A0A8012D08F7BA007EF675 /* ContentView 2.swift */; };
1011
7ED306AD2AF8455D00F6FFE3 /* SomeObjcClass.m in Sources */ = {isa = PBXBuildFile; fileRef = 7ED306AC2AF8455D00F6FFE3 /* SomeObjcClass.m */; };
1112
7ED5176E2AF68AB700D29ED7 /* spm_testApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7ED5176D2AF68AB700D29ED7 /* spm_testApp.swift */; };
12-
7ED517702AF68AB700D29ED7 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7ED5176F2AF68AB700D29ED7 /* ContentView.swift */; };
13+
7ED517702AF68AB700D29ED7 /* ContentView1.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7ED5176F2AF68AB700D29ED7 /* ContentView1.swift */; };
1314
7ED5177E2AF68AFD00D29ED7 /* JDStatusBarNotification in Frameworks */ = {isa = PBXBuildFile; productRef = 7ED5177D2AF68AFD00D29ED7 /* JDStatusBarNotification */; };
1415
/* End PBXBuildFile section */
1516

1617
/* Begin PBXFileReference section */
18+
28A0A8012D08F7BA007EF675 /* ContentView 2.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "ContentView 2.swift"; sourceTree = "<group>"; };
1719
7ED306AB2AF8455D00F6FFE3 /* SomeObjcClass.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SomeObjcClass.h; sourceTree = "<group>"; };
1820
7ED306AC2AF8455D00F6FFE3 /* SomeObjcClass.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SomeObjcClass.m; sourceTree = "<group>"; };
1921
7ED5176A2AF68AB700D29ED7 /* spm_test.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = spm_test.app; sourceTree = BUILT_PRODUCTS_DIR; };
2022
7ED5176D2AF68AB700D29ED7 /* spm_testApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = spm_testApp.swift; sourceTree = "<group>"; };
21-
7ED5176F2AF68AB700D29ED7 /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = "<group>"; };
23+
7ED5176F2AF68AB700D29ED7 /* ContentView1.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView1.swift; sourceTree = "<group>"; };
2224
/* End PBXFileReference section */
2325

2426
/* Begin PBXFrameworksBuildPhase section */
@@ -54,7 +56,8 @@
5456
isa = PBXGroup;
5557
children = (
5658
7ED5176D2AF68AB700D29ED7 /* spm_testApp.swift */,
57-
7ED5176F2AF68AB700D29ED7 /* ContentView.swift */,
59+
7ED5176F2AF68AB700D29ED7 /* ContentView1.swift */,
60+
28A0A8012D08F7BA007EF675 /* ContentView 2.swift */,
5861
7ED306AB2AF8455D00F6FFE3 /* SomeObjcClass.h */,
5962
7ED306AC2AF8455D00F6FFE3 /* SomeObjcClass.m */,
6063
);
@@ -144,7 +147,8 @@
144147
buildActionMask = 2147483647;
145148
files = (
146149
7ED306AD2AF8455D00F6FFE3 /* SomeObjcClass.m in Sources */,
147-
7ED517702AF68AB700D29ED7 /* ContentView.swift in Sources */,
150+
7ED517702AF68AB700D29ED7 /* ContentView1.swift in Sources */,
151+
28A0A8022D08F7BA007EF675 /* ContentView 2.swift in Sources */,
148152
7ED5176E2AF68AB700D29ED7 /* spm_testApp.swift in Sources */,
149153
);
150154
runOnlyForDeploymentPostprocessing = 0;
@@ -287,6 +291,7 @@
287291
INFOPLIST_KEY_UILaunchScreen_Generation = YES;
288292
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
289293
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
294+
IPHONEOS_DEPLOYMENT_TARGET = 18.0;
290295
LD_RUNPATH_SEARCH_PATHS = (
291296
"$(inherited)",
292297
"@executable_path/Frameworks",
@@ -317,6 +322,7 @@
317322
INFOPLIST_KEY_UILaunchScreen_Generation = YES;
318323
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
319324
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
325+
IPHONEOS_DEPLOYMENT_TARGET = 18.0;
320326
LD_RUNPATH_SEARCH_PATHS = (
321327
"$(inherited)",
322328
"@executable_path/Frameworks",
@@ -358,8 +364,8 @@
358364
isa = XCRemoteSwiftPackageReference;
359365
repositoryURL = "https://github.com/calimarkus/JDStatusBarNotification.git";
360366
requirement = {
361-
kind = upToNextMajorVersion;
362-
minimumVersion = 2.0.0;
367+
branch = main;
368+
kind = branch;
363369
};
364370
};
365371
/* End XCRemoteSwiftPackageReference section */
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
//
2+
//
3+
4+
import JDStatusBarNotification
5+
import SwiftUI
6+
7+
struct ContentView2: View {
8+
9+
@State var isPresented: Bool = false
10+
@State var activity: Bool = false
11+
@State var progress: Double = 0.0
12+
13+
var body: some View {
14+
List {
15+
Section {
16+
Button("Present/dismiss") {
17+
isPresented.toggle()
18+
}
19+
}
20+
21+
Section {
22+
Button("Activity on/off") {
23+
isPresented = true
24+
activity.toggle()
25+
}
26+
27+
Button("Shuffle progress") {
28+
isPresented = true
29+
progress = Double(arc4random() % 1000) / 1000.0
30+
}
31+
32+
Button("Reset") {
33+
activity = false
34+
progress = 0
35+
}
36+
}
37+
}
38+
.notification(title: "Simple text",
39+
subtitle: "with a little subtitle.",
40+
isPresented: $isPresented,
41+
isShowingActivity: $activity,
42+
progress: $progress,
43+
includedStyle: .success)
44+
}
45+
}
46+
47+
#Preview {
48+
ContentView2()
49+
}

spm_testProject/spm_test/ContentView.swift renamed to spm_testProject/spm_test/ContentView1.swift

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ import JDStatusBarNotification
55
import SwiftUI
66

77
extension NotificationPresenter {
8-
func includedStyle(_ style: IncludedStatusBarNotificationStyle) -> String {
9-
return addStyle(named: UUID().uuidString, usingStyle: style) { $0 }
8+
func addStyleForIncludedStyle(_ style: IncludedStatusBarNotificationStyle) -> String {
9+
return addStyle(named: "example-style", usingStyle: style) { $0 }
1010
}
1111
}
1212

13-
struct ContentView: View {
13+
struct ContentView1: View {
1414

1515
@State var isPresented: Bool = false
1616

@@ -26,27 +26,28 @@ struct ContentView: View {
2626

2727
Section("Swift style Presentation") {
2828
Button("Classic-Swift (1.5s)") {
29-
presenter.presentSwiftView(styleName: presenter.includedStyle(.dark)) {
29+
presenter.presentSwiftView(styleName: presenter.addStyleForIncludedStyle(.dark)) {
3030
HelloSPMView(title: "Now also working in SPM.")
3131
}
3232
presenter.dismiss(after: 1.5)
3333
}
34-
34+
3535
Button("State-based (toggle)") {
3636
isPresented.toggle()
3737
}
38-
.notification(isPresented: $isPresented, style: {
39-
let s = $0.backgroundStyle
40-
s.backgroundColor = .black
41-
s.pillStyle.minimumWidth = 150
42-
s.pillStyle.height = 44
43-
}) {
44-
Text("👋 Hi there!")
45-
.font(.subheadline)
46-
.foregroundStyle(.white)
47-
}
4838
}
4939
}
40+
.notification(isPresented: $isPresented, style: {
41+
let s = $0.backgroundStyle
42+
s.backgroundColor = .black
43+
s.pillStyle.minimumWidth = 150
44+
s.pillStyle.height = 44
45+
}) {
46+
Text("👋 Hi there!")
47+
.font(.subheadline)
48+
.foregroundStyle(.white)
49+
}
50+
5051
}
5152
}
5253

@@ -69,5 +70,5 @@ struct HelloSPMView: View {
6970
}
7071

7172
#Preview {
72-
ContentView()
73+
ContentView1()
7374
}

spm_testProject/spm_test/spm_testApp.swift

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,22 @@ import SwiftUI
55

66
@main
77
struct spm_testApp: App {
8-
var body: some Scene {
9-
WindowGroup {
8+
var body: some Scene {
9+
WindowGroup {
10+
TabView {
11+
Tab("Example 1", systemImage: "house") {
1012
NavigationView {
11-
ContentView()
12-
.navigationTitle("SPM Test App")
13+
ContentView1()
14+
.navigationTitle("SPM Example #1")
1315
}
1416
}
17+
Tab("Example 2", systemImage: "house") {
18+
NavigationView {
19+
ContentView2()
20+
.navigationTitle("SPM Example #2")
21+
}
22+
}
23+
}
1524
}
25+
}
1626
}

0 commit comments

Comments
 (0)